One great thing about AWS is how easy it is to integrate different services. Here is one of the examples.
Let's say you want to build the following solution:
- Clients are calling your contact center and when they press a certain option in the IVR you want to send them an SMS message. What this message contains depends on your requirements. In my case, I send an SMS with a link to instructions on how to install a new mobile application.
- Before sending the message you want to verify if this is a valid client and not just a random person.
You can do that by integrating Amazon Connect with Amazon Simple Notification Service (SNS).
Here is how to do that:
I created DynamoDB table called Clients.
It contains phone numbers for each client and some other information about each client.
Phone numbers must be in E.164 format.
I created Lambda function sendSMS. I use Python 3.9
How it works:
1. I get the contact attribute Customer number to get the phone number of the caller.
2. I run a query and check if this phone number is in Clients tables.
3. If it is found - it means it is a valid client
4. After that I connect to SNS and use action publish to send SMS.
In my example message is hardcoded in my Lambda function but depending on your particular requirements you can make it dynamic.
Here is my Lambda function:
import json import boto3 from botocore.exceptions import ClientError from boto3.dynamodb.conditions import Key def lambda_handler(event, context): dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('Clients') message="Link on how to setup our new mobile application http://tinyurl.com/AmazonConnectSMS" CLID=event['Details']['ContactData']['CustomerEndpoint']['Address'] response = table.query( KeyConditionExpression=Key('phoneNumber').eq(CLID) ) resp=response['Items'] for item in resp: phoneNumber=item['phoneNumber'] if phoneNumber==CLID: # Create an SNS client client = boto3.client("sns",region_name="us-east-1") # Send SMS message client.publish( PhoneNumber=CLID, Message=message ) return { 'statusCode': 200, 'body': json.dumps('OK') }
Now I just need to add my lambda function to Amazon Connect IVR flow.
I created a simple call flow.
It plays the following message:
"Hello. Welcome to IT Helpdesk. If you are calling from a mobile device about instructions on how to setup a new application please press 1 and we will send you instructions by SMS."
If the client presses 1 I invoke Lambda function sendSMS. Quite simple.
Hi, If customer number is not in the DynamoDB. Customer is getting the sms is possible. If is not possible share the some related docs to refer.
ReplyDelete