SmsWebhookRK
Public Member Functions | Protected Attributes
SmsMessage Class Reference

Class for setting parameters for a SMS message. More...

#include <SmsWebhookRK.h>

Public Member Functions

 SmsMessage ()
 Default constructor - doesn't really do anything.
 
virtual ~SmsMessage ()
 Default destructor - doesn't really do anything.
 
SmsMessagewithRecipient (const char *phoneNum)
 Sets the recipient phone number. More...
 
const char * getRecipient () const
 Gets the previously set phone number.
 
bool hasRecipient () const
 Returns true if the recipient is a non-empty recipient string.
 
SmsMessagewithMessage (const char *message)
 Sets the SMS message text. More...
 
const char * getMessage () const
 Gets the previously set message text.
 

Protected Attributes

String recipient
 Recipient phone number (+ country code format)
 
String message
 Message text to send.
 

Detailed Description

Class for setting parameters for a SMS message.

You typically use it like:

mesg.withRecipient("+12125551212")
.withMessage(String::format("Message %d!", ++counter));

Member Function Documentation

◆ withMessage()

SmsMessage& SmsMessage::withMessage ( const char *  message)
inline

Sets the SMS message text.

Parameters
messageThe SMS message text, limited to 140 characters.
Returns
*this so you can chain withXXX() calls, fluent-style

This method makes a copy of message string. If you don't set the message string, the Twilio API won't let you send an empty SMS, so an error will show in the integration log.

◆ withRecipient()

SmsMessage& SmsMessage::withRecipient ( const char *  phoneNum)
inline

Sets the recipient phone number.

Parameters
phoneNumRecipient phone number in + country code format, so for example, in the United States it begins with +1. The rest of the phone number should be be just digits, no punctuation.
Returns
*this so you can chain withXXX() calls, fluent-style

This method makes a copy of phoneNum string.

Instead of specifying the recipient in each SmsMessage object, you can use withRecipientCallback(). Providing a function to get the recipient is handy if you're storing the recipient in EEPROM or a file on the file system.


The documentation for this class was generated from the following file:
SmsMessage::withRecipient
SmsMessage & withRecipient(const char *phoneNum)
Sets the recipient phone number.
Definition: SmsWebhookRK.h:49
SmsMessage
Class for setting parameters for a SMS message.
Definition: SmsWebhookRK.h:23
SmsWebhook::queueSms
void queueSms(SmsMessage smsMessage)
Queue a SmsMessage to send.
Definition: SmsWebhookRK.cpp:28
SmsMessage::withMessage
SmsMessage & withMessage(const char *message)
Sets the SMS message text.
Definition: SmsWebhookRK.h:71
SmsWebhook::instance
static SmsWebhook & instance()
Get the singleton instance of this class.
Definition: SmsWebhookRK.cpp:9