Send data to AWS Connect¶
Amazon Connect is a contact center as a service (CCaS) solution that offers easy, self-service configuration and enables dynamic, personal, and natural customer engagement at any scale.
This topic describes the steps that are required to send customer profiles to AWS Connect from Amperity:
How this destination works¶
Use AWS Connect to send customer profiles from Amperity to a Lambda function, after which it is loaded to AWS Connect.
An AWS Connect destination works like this:
Use a query to return customer profiles. For example:
SELECT given_name AS "First Name" surname AS "Last Name" postal AS "Zip Code" email AS "Email Address" phone AS "Phone Number" FROM Merged_Customers
Configure a webhook destination to send data to a Lambda function that is running in AWS Lambda.
Deploy a Lambda function to AWS Lambda. The Lambda function may be deployed as a serverless application (recommended) or it may be a custom Lambda function that you have built using the open source toolkit provided by Amperity, and then uploaded to AWS Lambda.
Configure the Lambda function to run against the data that is sent from Amperity.
The Lambda function sends validated results to AWS Connect.
Get details¶
AWS Connect requires the following configuration details:
AWS Connect must be enabled in your Amazon AWS account. |
|
A Lambda function must be uploaded to AWS Lambda that is running in your Amazon AWS account, and then configured to be available to Amperity. |
|
A webhook destination that is configured in your Amperity tenant that sends query results to a Lambda function running in AWS Lambda. |
Configure AWS Connect¶
To configure AWS Connect, you must complete one of the following series of steps:
Serverless application¶
The AWS Serverless Application Repository is a managed repository for pre-built serverless applications. Find an application, configure it, and then deploy it to your Amazon AWS account.
Amperity manages a pre-built serverless application for AWS Connect. Use this application to send valid phone numbers and messages from Amperity to AWS Connect.
To deploy a serverless application
Log in to your Amazon AWS account.
Open the AWS Serverless Application Repository.
Search for the amperity-aws-connect-runner, and then open it. On the “amperity-aws-connect-runner” page, click Deploy to deploy the application to your Amazon AWS account.
Open the AWS Lambda console, and then open the “amperity-aws-connect-runner” Lambda function, and then click Configure.
Click Save.
Manual configuration¶
A manual configuration requires more steps than deploying a serverless application, but enables the use of a custom Lambda function and the ability to define inline policies.
To manually configure AWS Connect, do each of the following steps:
Add function to AWS Lambda¶
Add a basic function to your AWS Lambda console using only the default function without any customization.
To add a function to AWS Lambda
Log in to your Amazon AWS account.
Open the AWS Lambda console, and then click Create function.
Select Author from scratch.
Under Basic information, specify the function name, runtime, and architecture. For example:
Function name “Amperity function for AWS Connect”
Runtime “Python 3.9”
Architecture “x86_64”
Click Save.
Get Lambda function template¶
Amperity provides a pre-built collection of Lambda functions that is available from an open-source repository on GitHub.
Note
Lambda functions are built using Python. Amazon AWS provides runtimes for Python that include an SDK, along with credentials from an AWS Identity and Access Management (IAM) role that you manage.
To get the Lambda function template
Clone the open source amperity-lambda-runner repository or download it as a ZIP file.
In the repo, navigate to “/src/lambdas/lambda_handlers/”, and then open “amazon_pinpoint.py”.
You may use this file directly (requiring only configuration updates) or you may customize it to support your desired workflow.
Upload function to AWS Lambda¶
You must upload the application code (and any dependencies) to AWS Lambda as a ZIP file archive.
To upload a Lambda function to AWS Lambda
Add the application code and dependencies to a ZIP file archive.
Tip
To build the ZIP file for AWS Connect, run the following command from your amperity-lambda-runner directory:
sh util/lambda-build.sh filename=amazon_aws_connect.py
This will create a ZIP file that contains the following files: amazon_aws_connect.py, amperity_runner.py, and helpers.py.
Open the AWS Lambda console, and then open the Code tab.
Click Upload from, and then click ZIP file.
Find the ZIP file archive that contains the application code (and any dependencies), and then click Upload.
Click Save.
Configure function in AWS Lambda¶
AWS Lambda must be updated for the name of the AWS Connect application and to specify a timeout value.
To configure the Lambda function in AWS Lambda
Open the AWS Lambda console, and then open the Code tab.
Under Runtime settings, select Edit.
Under Handler, add “app.amazon_aws_connect”, and then click Save.
In the AWS Lambda console, open the Configuration tab.
Under General configuration, select Edit.
Set the Timeout value to “15 min 0 sec”, and then click Save.
Add the API gateway¶
Amazon API Gateway provides tools for creating and documenting web APIs that route HTTP requests to AWS Lambda functions. An API gateway is required to use webhook destinations.
To add an API gateway
Open the AWS Lambda console.
Open the Lambda function for AWS Connect.
Click Add trigger.
From the drop-down menu, select “API Gateway”, and then select the following:
Setting
Value
Intent
Create a new API
API type
REST API
Security
API Key
Click Add.
You will need these values when configuring the webhook destination in Amperity.
Set AWS Lambda environment variables¶
Use AWS Lambda environment variables provide to the Lambda function the name of the project, the origination number, and the region.
To set environment variables
Open the AWS Lambda console.
Open the Lambda function for AWS Connect.
Click Configuration.
On the Configuration page, click Environment variables, and then click Edit.
Click Save.
Define inline policy¶
You can use inline policies to manage access to the Lambda function in AWS Lambda.
To define an inline policy
Open the AWS Lambda console.
Open the Lambda function for AWS Connect.
Click Configuration.
On the Configuration page, under Execution role, and then click the name of the role to be used with this Lambda function.
Click Add permissions, click Attach policy, and then Create policy.
Select the following values:
Select Profile as the service.
Under List select ListProfiles.
Under Read select SearchProfiles.
Under Write select CreateProfile, DeleteProfile, and UpdateProfile.
Click Review policy, add a name for the policy (like “Amperity AWS Connect”), and then click Create policy.
Add webhook destination¶
Use a webhook destination to send query results from Amperity to a Lambda function running in AWS Lambda in your instance of Amazon AWS.
To add a destination
From the Destinations tab, click Add Destination. This opens the Add Destination dialog box.
Enter the name of the destination and a description. For example, “AWS Connect” and “Send customer profiles in AWS Connect”.
From the Plugin drop-down, select “Webhook”.
The “webhook” credential type is selected automatically.
From the Credential drop-down, select a credential that has already been configured for this destination or click Create a new credential, which opens the Create New Credential dialog box. For new credentials, enter a name for the credential, the API key, and the webhook URL. (The webhook URL is the endpoint for the API gateway.) Click Save.
Tip
The API key and webhook URL settings are available from your AWS Lambda console. Log in to your AWS Lambda console, and then click Configuration. The API key is in the Details section and the webhook URL is in the Triggers section.
For example:
API key AB1c2D3eFGH4j5KL6
Webhook URL https://acme.execute-api.us-east-123.amazonaws.com/Prod/run/
Select Allow business users to use this destination.
This allows users who have been assigned to the Amp360 User and/or AmpIQ User policies to use this destination with orchestrations and/or campaigns.
Select Allow business users with limited PII access to send data.
This allows users who have been assigned to the Restrict PII access policy option to use this destination with orchestrations and/or campaigns.
Click Save.
Add data template¶
A data template defines how columns in Amperity data structures are sent to downstream workflows. A data template is part of the configuration for sending query and segment results from Amperity to an external location.
To add a data template
From the Destinations tab, open the menu for a destination that is configured for AWS Connect, and then select Add data template. This opens the Add Data Template dialog box. Enter the name of the data template and a description. For example: “AWS Connect” and “Send customer profiles to AWS Connect.”. |
|
Verify business user access to queries and orchestrations and access to segments and campaigns. A business user may also have restricted access to PII, which prevents them from viewing and sending customer profile data. If business user access was not configured as part of the destination, you may configure access from the data template. |
|
Verify all configuration settings. Important Under Webhook settings, if Webhook Settings is empty, set it to empty curly braces: {}. Note When the settings required by AWS Connect were are not configured as part of the destination, you must configure them as part of the data template before making this destination available to campaigns. |
|
Review all settings, and then click Save. |