Amazon Connect is a cloud-based contact center service that allows businesses to easily provide exceptional customer service at any scale.
Setting Up in Amazon Connect
Prerequisites
- An existing Amazon Connect instance with Contact Trace Records (CTRs) enabled.
- Administrative permissions within your Amazon Connect instance.
- Access Amazon Connect:
- Log into the AWS Management Console at https://console.aws.amazon.com/
- Navigate to the Amazon Connect service and select your instance.
- Enable Contact Trace Records (CTRs):
- Within your instance settings, find the section for Data Storage.
- Ensure that Contact Trace Records (CTRs) are enabled and configured to capture the details of interactions you want to analyze.
Generating API Access
- Open the IAM Console: Navigate to https://console.aws.amazon.com/iam/
- Create a New IAM Role:
- Go to "Roles" -> "Create Role".
- Select "AWS Service" as the trusted entity and choose "Connect".
- Click "Next: Permissions".
- Attach Policy:
- Attach the
AmazonConnect_FullAccess
policy for broad access, or create a custom policy with these minimum permissions:connect:ListContactFlows
connect:ListContactTraceRecords
- Click "Next: Tags" (add tags if desired) -> "Next: Review".
- Give your role a descriptive name (e.g., "Dimension Connect Integration") and click "Create Role".
- Attach the
Retrieving Conversational Data
-
Choose Your Method:
- AWS SDK: Use the SDK for your preferred language (Python, JavaScript, etc.) for programmatic interaction.
- AWS CLI: Use the AWS Command Line Interface for convenient scripting.
-
Python Example (Boto3):
import boto3 # Replace with your credentials and region session = boto3.Session( aws_access_key_id='YOUR_ACCESS_KEY_ID', aws_secret_access_key='YOUR_SECRET_ACCESS_KEY', region_name='YOUR_CONNECT_REGION' ) connect = session.client('connect') # Get Contact Flows (if needed) response = connect.list_contact_flows(InstanceId='YOUR_CONNECT_INSTANCE_ID') # Get Contact Trace Records contact_id = 'YOUR_CONTACT_ID' # Obtain from contact flows or otherwise response = connect.list_contact_trace_records( InstanceId='YOUR_CONNECT_INSTANCE_ID', ContactId=contact_id ) # Process CTR data (see next step)
POST responses to Dimension
When you're ready to pass the data to Dimension, post it to the following endpoint:
https://tracker.dimensionlabs.io/track?platform=universal&v=10.1.1-rest&type=incoming&apiKey=API_KEY_HERE
Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE
with your api key.
You must send the data with the following fields:
- text – string – (required)
- userId – string – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID
To review all optional fields see our API reference.
The data to POST should pass the following data:
{
"text": "Hi, bot",
"userId": "+14155551234",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}
Sample cURL
curl -X POST -H "Content-Type: application/json"
-d '{"text":"Hi, bot","userId":"+14155551234","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}'
'https://tracker.dimensionlabs.io/track?platform=sms&v=11.1.0-rest&type=incoming&apiKey=API_KEY'
Notice, you must replace the placeholder API_KEY_HERE
above with your api key.