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.
- Open up the Get customer input block where your Lex Bot gets the user's input and add in a session attribute.
- Set the Destination Key to any name ( I set mine to
InboundCallerID
).
- Set Type to System.
- 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']