SMS
SMS Attributes
Name | Allowed values | Default value |
---|---|---|
to |
Phone number |
See below |
from |
Phone number |
See below |
action |
A relative or absolute URL address |
None |
method |
GET, POST |
POST |
statusCallback |
any url |
none |
statusCallbackMethod |
|
|
to
The 'to' attribute takes a valid E.164 phone number as a value. CPaaS will send an SMS message to this number. When sending an SMS during an incoming call, 'to' defaults to the caller. When sending an SMS during an outgoing call, 'to' defaults to the called party. The value of 'to' must be a valid phone number.
from
The from
attribute takes a valid E.164 or alphanumeric phone number as an argument. Alphanumeric numbers are limited to 11 characters. Accepted characters include both upper and lower case ASCII letters, the digits from 0 to 9, and space: [A-Za-z0-9 ].
When sending an SMS during an incoming call, from
defaults to the calling party. When sending an SMS during an outgoing call, from
defaults to the called party.
action
The 'action' attribute takes a URL address as an argument. After processing the <Sms> verb, CPaaS will make a GET or POST request to this URL with the form parameters 'MessageStatus' and 'MessageSid'. Using an 'action' URL, your application can receive synchronous notification that the message was successfully enqueued or not.
If you provide an 'action' URL, CPaaS will use the RCML received in your response to the 'action' URL request to continue the current call. Any RCML verbs occuring after an <Sms> which specifies an 'action' attribute are unreachable. If no 'action' is provided, <Sms> will finish and CPaaS will move on to the next RCML verb in the document. If there is no next verb, CPaaS will end the phone call.
method
The 'method' attribute takes the value 'GET' or 'POST'. This tells CPaaS whether to request the 'action' URL via HTTP GET or POST. This attribute is modeled after the HTML form 'method' attribute.
statusCallback
The statusCallback attribute allows you to specify a URL for CPaaS to send webhook requests to, on each event of message delivery (triggered for status callbacks).
statusCallbackMethod
The statusCallbackMethod attribute lets you specify which HTTP method CPaaS should use when requesting the URL in the statusCallback attribute. The default is POST.
StatusCallback Parameters
Parameter | Description | Example value |
---|---|---|
MessageSid |
The Sid of the SMS message. |
SMc5b1b09cf2b14ffe985461c3587f4c38 |
MessageStatus |
Last status known for this message. |
delivered |
From |
From address of the message (message sender) |
8888001 |
To |
To address of the message (message receiver) |
8888002 |
Body |
The message body. |
Hello world |
AccountSid |
The Account Sid. |
ACa272717421604a9d924a5837aa23711b |
ErrorCode |
Error code, if any. This parameter is optional. |
30001 |
Examples
Below is a simple example of how you can use the <Sms> verb.
<Response> <Sms>Hello World!</Sms> </Response>
The next RCML example showcases how you can use From
, To
and statusCallback
.
<Response> <Sms from="8888001" to="8888002" statusCallback="http://status.callback.url" statusCallbackMethod="POST">Hello World !!!</Sms> </Response>