Flow block in Amazon Connect: Invoke an AWS Lambda function
This topic defines the flow block for calling AWS Lambda to return key-value pairs that you can use to set contact attributes.
Description
-
Calls AWS Lambda, and optionally returns key-value pairs.
-
The returned key-value pairs can be used to set contact attributes.
-
For an example, see Tutorial: Create a Lambda function and invoke in a flow.
Supported channels
The following table lists how this block routes a contact who is using the specified channel.
Channel | Supported? |
---|---|
Voice |
Yes |
Chat |
Yes |
Task |
Yes |
Flow types
You can use this block in the following flow types:
-
Inbound flow
-
Customer Queue flow
-
Customer Hold flow
-
Customer Whisper flow
-
Agent Hold flow
-
Agent Whisper flow
-
Transfer to Agent flow
-
Transfer to Queue flow
Properties
The following image shows the Properties page of the AWS Lambda function block.
Note the following properties:
-
Timeout: Enter how long to wait for Lambda to time out.
If your Lambda invocation gets throttled, the request is retried. It is also retried if a general service failure (500 error) happens.
When a synchronous invocation returns an error, Amazon Connect retries up to three times, for a maximum of 8 seconds. At that point, the contact is routed down the Error branch.
-
Response validation: The Lambda function response could be either a STRING_MAP or JSON and has to be set while configuring the Invoke AWS Lambda function block in the flow. If response validation is set to STRING_MAP, then the lambda function should return a flat object of key/value pairs of the string type. Otherwise, if response validation is set to JSON, the lambda function can return any valid JSON including nested JSON.
Configuration tips
-
To use an AWS Lambda function in a flow, first add the function to your instance. For more information, see Add a Lambda function to your Amazon Connect instance,
-
After you add the function to your instance, you can select the function from the Select a function drop-down list in the block to use it in the flow.
Configured block
The following image shows an example of what this block looks like when it is configured. It has two branches: Success and Error.
Sample flows
Amazon Connect includes a set of sample flows. For instructions that explain how to access the sample flows in the flow designer, see Sample flows in Amazon Connect. Following are topics that describe the sample flows which include this block.
Sample Lambda integration flow in Amazon Connect
Scenarios
See these topics for scenarios that use this block: