Twilio two-way SMS and MMS messages allow you to carry on a conversation by both sending and receiving text and multimedia messages. This can enable a contact center agent to engage in an SMS-based chat with a customer, or let customers re-schedule appointments via text and receive automated responses.
How do I Receive Inbound SMS or MMS Text Messages?
You need to define where you want the received message sent to, i.e. what URL we should GET or POST the content to. You can specify this manually in the Console, or via the API. For full details, please see our article for Configuring Phone Numbers to Receive Calls or SMS Messages.
Once your phone number is configured properly, we’ll reach out with an HTTP POST or GET request to the configured URL whenever an incoming SMS or MMS message is received on your phone number. We’ll send you all the details of the message, including the from number, to number, message body, and any media they sent such as image files. We also try and share geo-information we can determine from the phone number, like the city, state, and country (when available). Please note this geo-information is derived from the phone number itself, and may not represent the user’s current location.
How do I Send Outbound SMS Text Messages?
There are two methods for sending an outbound message response:
- REST API: Sending an HTTP POST request to Twilio’s Messages API resource tells us to send a message. You simply specify the recipient phone number you want to send to, the Twilio resource you’re sending from (phone number, short code, Messaging service, etc. ), and the content of the message (text, pictures, links, etc). This can be in response to a previous inbound message, or initiated independently. For a full walkthrough, please see our guide How to Receive and Reply to SMS and MMS Messages.
- TwiML: The <Message> TwiML verb can be used to initiate an outbound message in direct response to an inbound message.
What Phone Numbers can I use for two-way SMS?
Any Twilio Phone Number that supports SMS can be used for two-way messaging local to the recipients (e.g. a German mobile number for a German audience). SMS support can be checked via a number of methods:
- Console: SMS support for Twilio Phone Numbers can be viewed at www.twilio.com/console/phone-numbers. Supported numbers will have an SMS icon under the CAPABILITIES heading.
- API: A GET request to the IncomingPhoneNumbers API Resource will also return SMS support information for your Twilio Phone Numbers. Our response will include a Capabilities property with boolean true/false values for SMS and MMS capabilities.
International two-way SMS
There may be some quirks with sending two-way SMS internationally. Our suggestion for a best practice is to always use a local long code or toll-free number where available (shortcodes do not support international messages). For example, we suggest using a UK number for 2-way messaging with UK recipients.
Alphanumeric Sender ID
Alphanumeric Sender IDs should only be used for one-way messages; the ID used is not a phone number, and thus cannot receive direct replies. We recommend instead that a local phone number is used for sending these messages, or a reply to number be included in the message. For more information, please see our article for Getting Started with Alphanumeric Sender ID.