TwiML is a set of instructions you can use to tell Twilio what to do when you receive an incoming fax, SMS, or phone call.
When Twilio receives a call to an Incoming Phone Number that has been configured as a Fax number, you will receive an HTTP request to the
FaxUrl configured for that number. Your server should respond with TwiML that instructs Twilio how to proceed.
Twilio makes HTTP requests to your application just like a regular web browser, in the format
application/x-www-form-urlencoded. By including parameters and values in its requests, Twilio sends data to your application that you can act upon before responding.
Twilio cannot cache POSTs. If you want Twilio to cache static TwiML pages, then have Twilio make requests to your application using GET.
The TwiML request for Programmable Fax will contain the following request parameters:
|FaxSid||The 34-character unique identifier for the fax|
|AccountSid||The account from which the fax was sent|
|From||The caller ID or SIP From display name|
|To||The phone number or SIP URI of the destination|
|ApiVersion||The API version used to send the fax, which for this API will be "v1"|
When a message comes into one of your Twilio numbers, Twilio makes an HTTP request to the message URL configured for that number.
In your response to that request, you can tell Twilio what to do in response to the message. You can configure your number URLs here.
Twilio behaves just like a web browser, so there's nothing new to learn.
Twilio will keep cookie state across multiple SMS messages between the same two phone numbers. This allows you to treat the separate messages as a conversation, and store data about the conversation, such as a session identifier, in the cookies for future reference. Twilio will expire the cookies for that conversation after four hours of inactivity.
Most XML elements in a TwiML document are TwiML verbs. Verb names are case sensitive, as are their attribute names. There are only two TwiML fax verbs at this time: