Use the Amazon Connect integration to connect PolyAI voice agents to your AWS ecosystem. Utilize Amazon Connect contact flows for dynamic call routing and DynamoDB and Lambda for real-time data processing.

Capabilities

Call handling and analytics

PolyAI voice agents manage inbound calls routed via Amazon Connect. Agents capture customer intent, execute knowledge-based responses, and reduce the load on live agents. Call performance, customer satisfaction, and agent efficiency are tracked using Amazon Connect analytics, integrated with PolyAI’s conversation data.

Live agent handoff

Calls requiring human assistance are routed to Amazon Connect agents with full contextual data for continuity and personalized support.

Secure data access

PolyAI securely retrieves and updates customer data using AWS STS and Amazon DynamoDB.

How the integration works

  1. Inbound call handling: Amazon Connect selects a number from a pool of PolyAI-provisioned phone numbers for incoming calls.
  2. Routing to PolyAI: Calls are transferred to the PolyAI conversational assistant, which retrieves contact attributes from DynamoDB using an AWS IAM role with appropriate permissions.
  3. Guided conversational flows: The PolyAI assistant greets the caller and executes customized conversational flows, such as identity verification or information collection.
  4. Handoff or resolution: If the query is resolved, the call is terminated. Unresolved queries are routed back to Amazon Connect for queue-based agent handling.
  5. Data management: Data from the interaction (e.g., transcripts, query status) is sent to Amazon Connect and stored in S3 buckets using the same AWS IAM role.

Setup guide

Prerequisites

  • Amazon Connect instance: Ensure an active Amazon Connect instance with administrative access.
  • PolyAI project: Set up a PolyAI assistant aligned with your Amazon Connect workflows.
  • AWS services:
    • DynamoDB: For securely storing call attributes.
    • Lambda: For processing event data.
    • STS: For secure role-based data access.
  • Integration credentials:
    • IAM role: Create an IAM role with policies for DynamoDB and Lambda access, allowing PolyAI to interact with AWS resources.

1: Configure Amazon Connect

  1. Log in to the AWS Management Console and open Amazon Connect.
  2. Use the Flow Designer to:
    • Create or edit a contact flow.
    • Add:
      • A PolyAI handoff node to route calls to the voice assistant.
      • A Lambda function node to retrieve and process call data.
  3. Save and publish the contact flow.

2: Set up DynamoDB for call attributes

  1. Create a DynamoDB table:
    • Define a primary key, such as CallID or CustomerID.
    • Add attributes like customer_name or reservation_number.
  2. Link the table to the Lambda function for real-time updates.

3: Configure AWS Lambda function

  1. Create a Lambda function in the AWS Management Console:
    • Use a provided or custom script to process call events.
  2. Assign an IAM role with:
    • Permissions for DynamoDB and STS.
  3. Deploy the function and link it to the Amazon Connect contact flow.

Example Lambda function template:

import boto3

def lambda_handler(event, context):
    dynamodb = boto3.resource('dynamodb')
    table = dynamodb.Table('YourDynamoDBTable')

    # Extract call attributes
    call_id = event['Details']['ContactData']['ContactId']
    caller_number = event['Details']['ContactData']['CustomerEndpoint']['Address']

    # Update or retrieve data
    response = table.update_item(
        Key={'CallID': call_id},
        UpdateExpression="SET caller_number =:val",
        ExpressionAttributeValues={':val': caller_number}
    )

    return {
        'statusCode': 200,
        'body': 'Call attributes updated successfully'
    }

4: Integrate PolyAI assistant

  1. Provide PolyAI with:
  2. Set up the integration using AWS CloudFormation:
    • PolyAI will share an AWS CloudFormation template using Amazon S3.
    • Create a service role in your AWS account with the following policy, with <YOUR_ACCOUNT_ID> replaced by your actual 12-digit AWS Account ID:
{
   "Version": "2012-10-17",
   "Statement": [
       {
           "Sid": "VisualEditor0",
           "Effect": "Allow",
           "Action": [
               "cloudformation:*"
           ],
           "Resource": "*"
       },
       {
           "Sid": "VisualEditor1",
           "Effect": "Allow",
           "Action": "s3:*",
           "Resource": "arn:aws:s3:::amazon-connect-integration-sample-code/<YOUR_ACCOUNT_ID>/*"
       },
       {
           "Sid": "VisualEditor2",
           "Effect": "Allow",
           "Action": "lambda:*",
           "Resource": "arn:aws:lambda:*:<YOUR_ACCOUNT_ID>:function:PolyAI*"
       },
       {
           "Sid": "VisualEditor3",
           "Effect": "Allow",
           "Action": "iam:*",
           "Resource": [
               "arn:aws:iam::<YOUR_ACCOUNT_ID>:policy/PolyAI*",
               "arn:aws:iam::<YOUR_ACCOUNT_ID>:role/PolyAI*"
           ]
       },
       {
           "Sid": "VisualEditor4",
           "Effect": "Allow",
           "Action": "dynamodb:*",
           "Resource": "arn:aws:dynamodb:*:<YOUR_ACCOUNT_ID>:table/PolyAI*"
       }
   ]
}
  1. Deploy the PolyAI CloudFormation stack, which will automatically create:
    • A DynamoDB table.
    • A Lambda function.
    • The required IAM roles.
  2. Update your Amazon Connect flow to route calls to PolyAI voice agents.

5: Test and deploy

  1. Test integration:
    • Verify everything works, like:
      • Try routing a call to various PolyAI assistants.
      • Make dummy data retrieval and status updates to test DynamoDB.
      • Simulate a live-agent handoff processes to make sure there are no problems.
  2. Monitor analytics:
    • Use the Amazon Connect analytics dashboard to track call volume, routing efficiency, and agent handoffs.

For support, contact PolyAI at support@polyai.com