AWS Contact Center

Using SMS to accept alphanumeric entry for voice calls with Amazon Connect

Organizations are increasingly using speech recognition to create powerful conversational interfaces in the contact center, enabling self-service, user identification, and caller authentication based on users’ spoken natural language. These capabilities create delightful experiences for the user and improve containment rates and customer satisfaction scores.

Oftentimes, in order to authenticate callers, organizations typically must collect alphanumeric strings (for example, “What is your customer ID?” or “Can you tell me the order ID you’re calling about?”). Occasionally, these IDs are a mix of numbers and letters. This style of input is often challenging for natural language solutions to accurately detect over low fidelity telephone networks, and customers may prefer an alternative such as SMS to avoid misinterpreted inputs.

In this blog, we will show you how to utilize SMS during an active Amazon Connect voice interaction to collect information accurately, increasing IVR containment rates and customer satisfaction. This solution uses Amazon Connect, Amazon Pinpoint, Amazon DynamoDB, and AWS Lambda.

Solution overview and architecture

In this example, we use Amazon Connect contact flows, which provide self-service capabilities. When a user calls in via phone, they’re prompted to provide a customer ID. We will demonstrate how Amazon Connect contact flows can invoke AWS Lambda to request an outbound SMS through Amazon Pinpoint to the user’s mobile number. When the user replies to the SMS message, Amazon Pinpoint will publish the response to an Amazon Simple Notification Service (Amazon SNS) topic, which will trigger a Lambda function. The Amazon Connect contact flow will notify the user when the message is sent, and will periodically query DynamoDB using Lambda until the user’s response is populated.

In this solution, we will create an Amazon Pinpoint two-way SMS application to support bidirectional SMS capabilities. We will also deploy an AWS CloudFormation template to create an Amazon SNS topic to receive inbound SMS from Amazon Pinpoint. The template also creates a DynamoDB table to store inbound SMS responses, and a helper Lambda function to subscribe to the SNS topic and populate the DynamoDB table with the inbound response. We will then import a sample contact flow to deploy the solution in Amazon Connect.

The flow of this architecture is as follows:

  1. A customer calls into a cloud contact center powered by Amazon Connect
  2. Call is delivered to Amazon Connect, a contact flow plays a message advising the user that they will receive a text message request to provide their account ID
  3. Amazon Connect contact flow invokes a Lambda helper function
  4. The helper function invokes Amazon Pinpoint to validate if the calling number is a valid mobile phone number
  5. If the calling number is a valid mobile phone number, the helper Lambda function then uses a Amazon Pinpoint API to send an SMS to the customer asking them to provide their account ID
  6. The helper Lambda stores a request ID for the request to match it when the customer response arrives
  7. Amazon Pinpoint sends an SMS request to the customer
  8. Customer responds with their account ID
  9. Amazon Pinpoint publishes response to Amazon SNS
  10. The helper Lambda is notified
  11. Helper Lambda stores the received account ID in the DynamoDB table
  12. Amazon Connect enters pause loop awaiting account ID
  13. Amazon Connect reads account ID from DynamoDB via Lambda helper function, Amazon Connect confirms account ID to caller

Note: This process is followed because of the asynchronous nature of this interaction. The Contact Flow cannot wait during Lambda execution for the return SMS, so it loops and waits for an update. Amazon Pinpoint uses Amazon SNS to notify Lambda that there’s a new inbound message to process, and Amazon Connect uses Lambda to poll the DynamoDB table for the update state.


To deploy this solution, we will perform the following steps:

  • Claim SMS-Enabled toll free number in Amazon Pinpoint
  • Deploy CloudFormation Stack
  • Configure Amazon Pinpoint phone numbers
  • Configure Amazon Connect


For this walkthrough, you should have the following prerequisites:

Claim SMS-Enabled toll free number in Amazon Pinpoint

The first step is to claim an SMS-Enabled toll free number in Amazon Pinpoint:

  1. Sign in to AWS Management Console and navigate to the Amazon Pinpoint console
  2. Select Phone numbers in the SMS and voice category
  3. Select Request Phone Number
  4. Select Toll-free or 10DLC and enable SMS under capabilities.
  5. Select Transactional for default message type
  6. Choose NextNOTE: If you do not currently have an SMS-enabled phone number in Amazon Pinpoint, you must follow special registration or request procedures to obtain an SMS-enabled number. For toll-free, you must register the toll free number before you can send SMS. For 10 Digit Long Codes, you must request a limit increase to allow for claiming 10DLC numbers.
  7. Choose Request, and momentarily you will see the Toll-free Number assigned. Make note of this toll-free number, you will need it to deploy the CloudFormation stack in a later step.

Deploy CloudFormation stack

To test this solution, deploy it using AWS CloudFormation. This will deploy and configure the necessary services, and insert a contact flow into your Amazon Connect instance.

To begin, log into the AWS Management Console and select the AWS Region where your Amazon Connect instance is hosted.

  1. Choose the Launch Stack button to create a new stack:
  2. Update the default parameters of the stack to match your environment. You’ll need:
    • A valid Amazon Connect Instance ID. You can obtain your instance ID from the Amazon Connect console.
    • The toll-free number that you created in the previous section.
  3. In the information box, select the presented acknowledgements. This gives AWS CloudFormation permission to create the IAM permissions required for this solution on your behalf.

Configure Amazon Pinpoint phone number

  1. Navigate to the Amazon Pinpoint console.
  2. Select Phone Numbers under the SMS and voice heading
  3. Select the toll-free number you previously created
  4. Expand the Two-way SMS header and select Enable two-way SMS
  5. Select Choose an existing SNS topic, and select the SNS topic that includes your-stack-name-SMSInboundMsgStreamingTopic from the list
  6. Choose Save

Configure Amazon Connect

  1. Log into your Amazon Connect instance administration console
  2. Navigate to Phone Numbers in the Channels category
  3. Assign a number to the Contact Flow named ‘SmsBlogContactFlow’


To test this solution:

  1. Call the phone number you assigned to the Contact Flow from a mobile phone
  2. While the Contact Flow greeting plays, you will receive an SMS to your mobile phone
  3. Reply to the SMS with an alphanumeric identifier. You will receive a confirmation SMS with the input you replied with.
  4. Press any key when prompted by the Contact Flow. The Contact Flow will play the received alphanumeric code back for confirmation.

Cleaning up

To avoid incurring future charges:

  1. Remove the phone number from the SmsBlogContactFlow
  2. Delete the CloudFormation stack that you created
  3. Remove the Amazon Pinpoint number that you claimed


Complex inputs such as email addresses and alphanumerichave traditionally been challenging to to accurately detect over low fidelity telephone networks. In this blog, we learned how to use Amazon Lex, Amazon Pinpoint, and Amazon SNS to enable Amazon Connect Contact Flows to send and receive SMS messages to collect complex input accurately in a way that is easy to use for customers. This will allow you to produce powerful self-service functions, increasing call deflection rates for your contact center and simplifying the customer experience for your customers. Contact us to learn more.

Join us for AWS Contact Center Day, a free virtual event where you’ll learn about the future of customer service, how machine learning can optimize customer and agent experiences—and more. Register now »

Author Bios

Greg Thomas is a Solutions Architect for Amazon Connect at AWS. He is part of the Scaling Solutions Architect team and helps organizations remove roadblocks to operating customer engagement workloads at scale. In his spare time, you can find him at football games, reading, and spending time with wife and children.
Naveen Narayan is a Senior Specialist Solutions Architect at AWS. He helps customer achieve their desired business outcomes in the Contact Center space leveraging Amazon Connect.