Your SMS-enabled incoming phone numbers will have a callback-url specified, so that if somebody SMS your phone number, Twilio will consult your URL with the Sid, From, To, and Body of the message. You can easily respond to the SMS by returning a text/plain or TwiML response to Twilio.
Twilio sends data to your application using either an HTTP POST or GET.
When an SMS is received by Twilio, we will perform an HTTP request to your webserver. The following fields will be sent (via POST, or via URL query parameters, depending on which HTTP method you've chosen):
| Property | Description |
|---|---|
| SmsSid | A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API |
| AccountSid | The 34 character id of the [Account][account] this Message is associated with. (Your account!) |
| From | The phone number that sent this message |
| To | The phone number of the recipient |
| Body | The text body of the SMS message. Up to 160 characters long. |
If you use HTTP GET instead of POST, Twilio passes metadata about the call as URL query string parameters. The names and behavior are the same as those values passed in a POST. Here's an example query string with the above parameters:
http://myserver/callhandler.php?Body=How+are+you+doing&From=4158675309&To=4155551212&AccountSid=AC394848B8393DF323