DEV Community

Cover image for Amazon connect -> manage prompts
Naresh Talluri
Naresh Talluri

Posted on

Amazon connect -> manage prompts

Amazon connect launches api to manage prompts, which allow us to perform CRUD operations along side configure in your contact flow, here are the benefits of doing so.

  • It allows you to configure prompts by customer/caller phone number
  • It scales unlimited prompts(right now amazon has limit about 5000 prompts per instance)

architecture flow

Image description

here are the steps to create and manage them

Step-1
create a prompt

Amazon connect launches api to manage prompts, here is the code snippet to create a prompt by using javascript sdk

var params = {
  InstanceId: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  S3Uri: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  Tags: {
    '<TagKey>': 'STRING_VALUE',
  }
};
connect.createPrompt(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});
Enter fullscreen mode Exit fullscreen mode

Step-2
have an entry in dynamo db by phone number

When you create a prompt in step-1, you get prompt id & arn, create an entry in dynamo db with these details associate with customer toll free number/DID

Step-3
create a lambda function to get the prompt details by phone number

create a lambda function with nodejs runtime, expect an input as phone number, and get the item from dynamo db and return the prompt arn in the response.
here is the sample code snipper

var params = {
  Key: {
   "PhoneNumber": {
     S: "8xxx"
    }
  }, 
dynamodb.getItem(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful 
 });

return {"promptARN":"arn:aws:connect:us-east-1:123456789012:instance/abcdef12-3456-7890-abcd-ef1234567890/prompts/guid-1234-abcd-5678-efgh"}
Enter fullscreen mode Exit fullscreen mode

Step-4
configure in contact flow

Invoke lambda function which you configured on above step, pass the external user defined value in prompt flow

Image description

That's all, this solution helps you manage your prompts and scale to unlimited, please make sure you create a web UI to manage your prompts and associate with customer/caller phone numbers.

Top comments (1)

Collapse
 
solomonmark profile image
SolomonMark

Excellent article on connect prompts