TwiML is a set of instructions you can use to tell Twilio what to do when you receive an incoming call, SMS or fax.
There is <Say>, <Record>, <Gather> verbs in TwiML.
The <Say> verb converts text to speech that is read back to the caller.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman" language="fr-FR">Chapeau!</Say>
</Response>
The <Gather> verb
- The caller enters digits followed by a # symbol or 5 seconds of silence. Twilio will submit those digits in a POST request back to the URL hosting your TwiML.
- The caller doesn’t enter any digits and 5 seconds pass. Twilio will move on to the next TwiML verb in the document – since there are no more verbs here, Twilio will end the call.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather input="speech dtmf" timeout="3" numDigits="1">
<Say>Please press 1 or say sales for sales.</Say>
</Gather>
</Response>
The <Record> verb records the caller’s voice and returns to you the URL of a file containing the audio recording.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record timeout="10" transcribe="true" />
</Response>