When an incoming SMS or MMS message is received by one of your Twilio numbers, Twilio makes an HTTP request to the A MESSAGE COMES IN option configured for this number. This Twilio app needs to then respond with valid TwiML directions describing how to handle that incoming message.
In order to receive incoming messages, without sending an auto-response, the Twilio app should respond with a simple empty Response -
<Response></Response>. Read on for more details and instructions to get your Twilio phone number configured for this use case.
Use a TwiML Bin to Receive SMS and MMS Messages without Responding
TwiML Bins allow for simple XML scripting with little to no programming experience needed. For more information on TwiML Bins, please see our blog post here: TwiML Bins: A Serverless and Codeless Way to Try Twilio
Recommended for: Twilio users who want to get up and running quickly, without their own web hosting.
Set up: Setting up a TwiML Bin only requires creating the bin, adding a single line of code, and then configuring it on your number. Here are the instructions:
- Login to your account at www.twilio.com.
- Click Runtime.
- Click TwiML Bins, and then select Create New TwiML Bin, or the red plus + sign button.
- Add a Friendly Name and some TwiML, and then click Create.
- Friendly Name: This is up to you - we select using something that gives an idea of what the TwiML Bin will do like “smsNoResponse”.
- TwiML: For the code, you will use a simple empty open and closed <Response>. You should end up with something like this:
Use a Webhook to Receive SMS and MMS Messages without Responding
Webhooks allow you to host your own TwiML from a simple XML script or one of our Helper Libraries. For more information on Webhooks, please see our page here: What is a Webhook.
Recommended for: Twilio users who want a completely customizable Twilio application.
Set up: Setting up a Webhook requires you to create your code with a simple empty open and closed <Response>. Here's an example of how this code may look using PHP:
<?php header('Content-Type: text/html'); ?> <Response></Response>
Once your code is live, you’ll then need to update your Twilio phone number with the Webhook URL for handling incoming SMS messages. You can find instructions for updating your phone number here: Configuring phone numbers to receive calls or SMS messages.