TelAPI allows SMS messages to be sent during a call using the <Sms> element. The SMS receiver (to attribute) must be a valid phone number and the sender (from attribute) must be one of your registered TelAPI numbers. Text of the message should be placed inside the element and can not be longer than 160 characters.
The action attribute can be used to direct the SMS to a new InboundXML document for processing. If directed to a new InboundXML using the action attribute, all InboundXML beneath the <Sms> element in the originating InboundXML document is disregarded. Similarly, the statusCallback attribute is provided to report the outcome of the SMS transmission.
The attributes below can be used to change some <Sms> behaviors.
| Attribute | Description |
|---|---|
|
optional
|
The phone number that will receive the SMS message. If this parameter is not specified, the SMS will be sent back to the number that made the request to the TelAPI number's SMS request URL.
|
|
optional
|
The number that will display as sending the SMS message. This should be one of your TelAPI numbers. If this parameter is not specified, the default from number is the TelAPI number hosting the SMS request URL.
|
|
optional
|
URL to direct TelAPI to once the <Sms> element is executed. Paramaters specific to <Sms> are sent here along with the request.
|
|
optional
|
Method used to request the action URL.
|
|
optional
|
URL where the status of the SMS can be sent.
|
In addition to the default voice request parameters, these parameters are forwarded to the action URL.
| Attribute | Description |
|---|---|
|
The Sid TelAPI has assigned for the SMS message.
|
|
|
The current status of the SMS message. Either sent or failed.
|
|
|
The text of the SMS message you want to send. 160 character limit.
|
The <Sms> element cannot be nested within any other verbs besides the default <Response> element.
The <Sms> element cannot nest any other elements within itself. It must only nest the text which is to be sent in the message.
The InboundXML below will say "I will now send an SMS!" and then send an SMS that reads "Test message sent from TelAPI!" to the specified from number.
<Response>
<Say>I will now send an SMS!</Say>
<Sms from="{phone_number}" to="{phone_number}">
Test message sent from TelAPI!
</Sms>
</Response>
Our helper libraries simplify the task of generating InboundXML while programming. The code below will output the above InboundXML example.
All TelAPI numbers which haven't yet had a user supplied SMS request URL set are provided with the following default SMS filtering behaviors: