Inbound messaging
With two-way SMS, you receive incoming messages from your customers. When a customer sends a message to your phone number, AWS End User Messaging delivers the message body to an Amazon SNS topic or an Connect Customer instance that you designate, where your application processes it – for example with Lambda or Amazon Lex to build interactive experiences.
When you use two-way SMS, consider the following:
Two-way SMS is only available in certain countries and regions. For more information, see Launch in a country.
Sender IDs do not support two-way SMS messaging.
Two-way MMS is not supported, but your phone number can still receive incoming SMS messages in response to an outbound MMS message.
Connect Customer for two-way SMS is available in the AWS Regions listed in Chat messaging: SMS subtype in the Connect Customer administrator guide.
Inbound SMS messages are not guaranteed to arrive in the order they were sent. Amazon SNS Standard topics deliver with best-effort ordering; if your application requires ordered processing, use the timestamp from the Amazon SNS notification metadata to order messages at the application layer.
Enable two-way messaging
Enable two-way SMS on a phone number, or on a phone pool to apply it to every number in the pool. Use the AWS End User Messaging console or the AWS CLI.
Note
AWS End User Messaging needs permission to publish to your destination. Grant it with an Amazon SNS topic
policy, or with an IAM role that trusts the sms-voice.amazonaws.com service
principal and allows sns:Publish (or the equivalent for Connect Customer). For the policy
details and event-record routing, see Event destinations in AWS End User Messaging.
Example inbound message payload
When your number receives an SMS message, AWS End User Messaging sends a JSON payload to the Amazon SNS topic you designated, as in the following example:
{ "originationNumber":"+14255550182", "destinationNumber":"+12125550101", "messageKeyword":"JOIN", "messageBody":"EXAMPLE", "inboundMessageId":"cae173d2-66b9-564c-8309-21f858e9fb84", "previousPublishedMessageId":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" }
| Property | Description |
|---|---|
originationNumber | The customer's phone number that sent the incoming message. |
destinationNumber | Your dedicated phone number that the customer sent to. |
messageKeyword | The registered keyword associated with your dedicated phone number. |
messageBody | The message the customer sent. |
inboundMessageId | The unique identifier for the incoming message. |
previousPublishedMessageId | The unique identifier of the message the customer is responding to. |