Twilio Send Response to SMS Webhook
Audience:
Low-code EngineersSkill Prerequisites:
APIs,Actions,Tokens
Answers a Twilio SMS webhook with a TwiML document, Twilio's XML format for instructions. It can reply to the sender with a message, send Twilio on to another URL, or just tell Twilio the SMS was received.
Use it as the last action of the API endpoint that receives the SMS. Twilio Parse Webhook SMS explains the whole flow.
It ends the action list, so actions after it don't run. It doesn't need a Twilio connector, because Twilio sends the reply itself.
This action is part of the Twilio SMS add-on, which is installed and licensed separately (feature package TWILIOSMS). If it isn't licensed, the action fails with a not-licensed error.
Typical Use Cases
- Reply to an incoming SMS, for example with an order status or a confirmation
- Acknowledge an SMS without replying, so Twilio doesn't log an error
- Pass the conversation to another API endpoint that handles the next step, for example based on a keyword
Don't use it to
- Send an SMS outside a webhook, or to someone other than the sender. Use Send SMS using Twilio.
- Return other TwiML, such as voice instructions. Use Raw Response with your own XML.
Related Actions
| Action Name | Description |
|---|---|
| Twilio Parse Webhook SMS | Reads the incoming SMS into tokens. Run it first. |
| Send SMS using Twilio | Sends a new SMS through the Twilio API. |
| Raw Response | Returns any response you write yourself, including custom TwiML. |
Input Parameter Reference
The parameters unique to this action are listed below. Review the common parameters for all actions here.
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| SMS Response Body | The text Twilio sends back to the sender. Leave it empty to reply with nothing. The text isn't escaped. See TwiML escaping. | Yes | empty string | No |
| Status Callback URL | A URL that Twilio calls after sending the reply, with the fields MessageStatus and MessageSid. See Twilio's message status values. The response of that URL tells Twilio what to do next. It's only used when SMS Response Body has a value and Use Redirect is off. A relative URL is made absolute with the current site address. | Yes | empty string | No |
| Use Redirect | When checked, Twilio continues with the TwiML at URL To Redirect To after sending the reply. For example, another API endpoint that uses this action. See Twilio's Redirect documentation. | Yes | false | No |
| URL To Redirect To | The URL Twilio goes to next. Shown when Use Redirect is checked. If it's empty, the action fails. | Yes | empty string | Yes, with Use Redirect |
| Use POST Http Method | When checked, Twilio calls URL To Redirect To with POST. Otherwise it uses GET. Shown when Use Redirect is checked. | Yes | false | No |
Output Parameters Reference
This action doesn't create tokens. It returns the TwiML as the API's response, with status 200 OK and Content-Type: text/html.
What the response looks like
| Settings | Response |
|---|---|
| Everything empty | <Response></Response> |
| SMS Response Body only | <Response><Message>Thanks!</Message></Response> |
| SMS Response Body and Status Callback URL | <Response><Message action="https://www.example.com/sms-status">Thanks!</Message></Response> |
| SMS Response Body and Use Redirect | <Response><Message>Thanks!</Message><Redirect method="GET">https://www.example.com/next-step</Redirect></Response> |
| Use Redirect only | <Response><Redirect method="GET">https://www.example.com/next-step</Redirect></Response> |
The reply message always comes before the redirect. With a status callback, Twilio continues with the callback's response instead, which is why Status Callback URL is hidden when Use Redirect is checked.
TwiML escaping
The text and URLs are inserted into the XML exactly as they are. They aren't escaped.
- Special characters break the reply. A
&or<in the message, for exampleQ&A, makes the TwiML invalid. Twilio doesn't send the reply and logs an error. Write&and<instead. URLs with several query string fields need&between them too, for examplehttps://www.example.com/next?step=2&lang=en. - Never put the sender's text in the reply. A token such as
[Sms:Body]holds whatever the sender typed. Someone can send XML that closes the message and adds their own TwiML, for example another<Message>to a different number, sent from your account and at your cost. The same goes for any other value users can enter, such as names from a form. Only use tokens whose values you control, such as IDs, dates or statuses from your database.
Considerations
- Always end the webhook with this action, even with every parameter empty. The empty response tells Twilio the SMS was handled, so Twilio doesn't log an error.
- Use it in API endpoints. It's designed to be the response of the endpoint Twilio calls. Only the first final action that runs returns the response. Use conditions to choose between replies.
- Replies count as sent messages. Twilio charges for each reply like any other SMS.
- Secure the endpoint. Twilio's signature isn't checked, so anyone who knows the URL can trigger a reply. See Securing the webhook.
Examples
To understand how to use the below examples, please see Running Examples.
These examples assume Twilio Parse Webhook SMS ran first with the output token Sms.
1. Acknowledge without replying
This action tells Twilio the SMS was received, without sending anything back.
{
"Title": "Twilio Send Response to SMS Webhook",
"ActionType": "TwilioSendSmsResponse",
"Description": "Acknowledge the SMS",
"Parameters": {
"ResponseMessage": "",
"StatusCallbackUrl": "",
"UseRedirect": false,
"UrlToRedirectTo": "",
"UsePOSTForRedirect": false
}
}
2. Reply with an order status
This action replies with the status of an order. The OrderId and OrderStatus tokens come from an earlier Run SQL Query that looked up the order from the message. It only runs when an order was found.
{
"Title": "Twilio Send Response to SMS Webhook",
"ActionType": "TwilioSendSmsResponse",
"Description": "Reply with the order status",
"Condition": "[OrderStatus] != \"\"",
"Parameters": {
"ResponseMessage": "Order [OrderId] is [OrderStatus]. Reply HELP for more options.",
"StatusCallbackUrl": "",
"UseRedirect": false,
"UrlToRedirectTo": "",
"UsePOSTForRedirect": false
}
}
3. Reply, then continue at another endpoint
This action confirms the subscription and then sends Twilio to another API endpoint with POST. Replace the URL with the URL of your endpoint, which the API editor shows.
{
"Title": "Twilio Send Response to SMS Webhook",
"ActionType": "TwilioSendSmsResponse",
"Description": "Confirm and hand over to the survey endpoint",
"Parameters": {
"ResponseMessage": "You're subscribed. We'll send you a short survey next.",
"StatusCallbackUrl": "",
"UseRedirect": true,
"UrlToRedirectTo": "https://www.example.com/sms-survey",
"UsePOSTForRedirect": true
}
}
Revised 09/27/2026