<Message>
Send an SMS or MMS as a side-effect of the voice call.
Element body
The message text, or nested <Body> and <Media> children.
Example
<Response>
<Message to="+12125550100" from="+12125550199">Your appointment is confirmed for 3 PM.</Message>
<Message to="+12125550100">
<Body>Here is the map to our office.</Body>
<Media>https://example.com/map.png</Media>
</Message>
</Response>
Attributes
| Attribute | Default | Behaviour |
|---|---|---|
to |
the call's other party |
E.164 destination number. When omitted: the caller on an inbound call, the called number on an outbound call. |
from |
the call's own number |
Sending number. When omitted: the number called on an inbound call, the caller ID on an outbound call. |
action |
unset |
URL requested once the message is handed off, with MessageSid and MessageStatus (sending, or invalid for a malformed to number). Its VoiceML response replaces the rest of the document; without action the call continues to the next verb. |
method |
POST |
HTTP method for the action request. |
statusCallback |
unset |
URL that receives the delivery result asynchronously: MessageSid and MessageStatus (sent or failed). With an action, it fires after the action request. |
Nesting
<Message> accepts these nested elements:
Callbacks
action request
| Field | Description |
|---|---|
MessageSid |
Identifier of the message record. |
MessageStatus |
sending, or invalid when the to number is malformed. |
statusCallback request
| Field | Description |
|---|---|
MessageSid |
Identifier of the message record. |
MessageStatus |
sent or failed. |
Every callback also carries the standard call parameters (CallSid, AccountSid, From, To, CallStatus) and is signed with your account's API key.
Notes
- Without an action the call continues to the next verb regardless of send outcome. Every send creates a Message record (SM-prefixed identifier) queryable over REST.
- When any <Body> child is present the message text comes from the <Body> children and the element's own text is ignored. Any <Media> child sends the message as MMS.