1

I have Connect and Lex up and running and I can customize my Lex chatbot via a lambda that checks the incoming phone number. I would like to use caller id info to look up customer info for the lambda to use.

How do I get the inbound caller id info?

rgettman
  • 176,041
  • 30
  • 275
  • 357
bww00
  • 71
  • 1
  • 3

2 Answers2

4

Use Contact Attributes

Contact attributes let you store customer input or data about a customer, and then use it later in a contact flow.

Contact attributes let you pass data between Amazon Connect and other services, such as Amazon Lex and AWS Lambda. Contact attributes can be both set and consumed by each service. For example, you could use a Lambda function to look up customer information, such as their name or order number, and use contact attributes to store the values returned to Amazon Connect. You could then reference those attributes to include the customer's name in messages using text to speech, or store their order number so they do not have to enter it again.

How to set Contact Attributes

To set a contact attribute with a Set contact attributes block

  1. In Amazon Connect, choose Routing, Contact flows.
  2. Select an existing contact flow, or create a new one.
  3. Add a Set contact attributes block.
  4. Edit the Set contact attributes block, and choose Use text.
  5. For the Destination key, provide a name for the attribute, such as Company. This is the value you use for the Attribute field when using or referencing attributes in other blocks. For the Value, use your company name.
    You can also choose to use an existing attribute as the basis for creating the new attribute.

What customer data can you get from System Attributes?

Customer number
Dialed number
Customer callback number
Stored customer input
...and more

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32
0

For anyone in the future having difficulty.

In Amazon Connect, you can pass contact attributes (Inbound Caller ID) from inside the customer input block where the Lex Bot exists to the Lambda that the bot calls.

  1. Open up the Get customer input block where your Lex Bot gets the user's input and add in a session attribute.
  2. Set the Destination Key to any name ( I set mine to InboundCallerID).
  3. Set Type to System.
  4. Set Attribute to Customer Number.

Now you can access the customer number via the event variable from inside your lambda.

Example:

def lambda_handler(event, context):
    phone_number = event['sessionState']['sessionAttributes']['InboundCallerID']
Tangy
  • 85
  • 9