AWS Contact Center

Real-time data export of Amazon Connect Customer Profiles to Salesforce using Amazon Kinesis

Introduction

Amazon Connect Customer Profiles helps companies deliver faster and personalized customer service in contact centers. This is achieved by providing agents and automated experiences (e.g., IVR) instant access to customer information without the latency and costs of integrating data from multiple systems (SaaS apps, databases, etc). Companies can bring data from over eighty application connectors to create profiles, use entity resolution to remove duplicate profiles, and get low latency access to their unified profiles. With a complete view of relevant customer information in a single place, companies can provide more personalized customer service, deliver more relevant campaigns, and improve customer satisfaction

With every interaction before and during on-going customer support, companies need the most up to date information across applications and business users. Companies can now keep their source system’s (e.g. CRMs and automation tools) data up-to-date with latest information from Amazon Connect Customer Profiles. For example, when a customer calls the contact center to update their address, an agent can make this change, and the updated profile information is sent to an Amazon Kinesis Data Stream in real-time. Companies can enable data streaming and automatically receive data for new profiles and updates to existing profiles into their Kinesis Data Stream. In this blog post, we will demonstrate how a company can export customer profile data into Salesforce and Amazon Simple Storage Service (Amazon S3) in real-time. By doing this, the company ensures that data gathered and updated in the contact center matches their source system data.

Solution Overview

Figure 1: Solution architecture

  1. Agent create/update customer profile data via Amazon Connect Agent Workspace
  2. Amazon Connect instance sends create/update events into Amazon Connect Customer Profiles
  3. Customer Profiles create/update events are streamed through Amazon Kinesis Data Streams
  4. Amazon Kinesis Data Streams writes create/update events into Amazon Kinesis Data Firehose
  5. Amazon Kinesis Data Firehose exports Customer Profiles event data to Amazon S3
  6. AWS Lambda is triggered by the create/update events from Amazon Kinesis Data Stream
  7. AWS Lambda invokes Salesforce API to update Customer Profiles event data to Salesforce

Prerequisites

For this walk through, it is assumed you have the following prerequisites:

  • An AWS account.
  • An Amazon Connect instance.
  • Amazon Connect Customer Profiles is enabled in the Amazon Connect instance.
  • A Salesforce instance with customer data.
  • A data source integration already created between Salesforce and Amazon Connect using Amazon AppFlow, with Salesforce contact as the specific object.
  • Setup the code in your local Linux setup:
    • Clone the code using following command: git clone https://github.com/aws-samples/customer-profiles-export-demo.
    • Run the following makeZip.sh script to download dependencies: ./makeZip.sh
    • On successful execution, you should see 2 files: lambda.zip and template.yaml in the root folder of the local repository, which would be used in later steps.

Walkthrough

  1. Sign in to the AWS Management Console.
  2. Search for Amazon S3 on the AWS Console services search bar and click on S3.

         

  1. Create a new S3 bucket in the same region you have your Amazon Connect instance. Make a note of the S3 bucket name.
  2. Upload the lambda.zip and template.yaml created in the pre-requisites to the home folder in the S3 bucket created in the previous step. Make a note of the Object URL for template.yaml
  3. Search for CloudFormation on the AWS Console services search bar and click on CloudFormation.

         

  1. Click on Create Stack. With new resources (standard).
  2. Click on Template is ready in Prerequisite section and choose Amazon S3 URL as template. source. In the Amazon S3 URL, put the Object URL of template.yaml noted in Step 4. Click on Next.

  1. Enter the AWS CloudFormation Stack Name.

  1. Enter the Parameters for the CloudFormation template as follows:
    1. Enter the S3 Bucket Name created in Step 3 in the CPDemoDeployBucketName parameter.
    2. Enter the AmazonConnectInstanceARN for your existing Amazon Connect Instance.
    3. To identify all the resources created by this template, enter the prefix of your choice.
    4. Enter the S3 bucket name used to store all audit logs in the field. CPDemoAuditBucketName. Refer to S3 bucket naming rules here.

    1. Enter the Salesforce username in the SFUsername field.
    2. Enter the Salesforce user password in the SFPassword field.
    3. Enter the Salesforce Access token in the SFAccessToken field.
    4. Enter the Salesforce hostname in the SFHost field.
    5. Enter the Salesforce version in the SFVersion field, this current demo is built on v57.0.
    6. Enter whether the Salesforce instance is a production instance or not in the SFProduction field, valid values are “true” for production or “false” for non-production environment.
    7. Enter the Salesforce consumer key in the SFConsumerKey field.
    8. Enter the Salesforce consumer secret in the SFConsumerSecret field.

  1. Click on Next in the with the default selected options in the Configure stack options page.
  2. Select all the “I acknowledge …” statements check box at the last step, and then chose “Submit”.
  3. When the CloudFormation Stack status is “CREATE_COMPLETE”, click on the Resources tab and note the name of the Kinesis Stream created.
  4. Search for Amazon Connect on the AWS Console services search bar and click on Amazon Connect.

  1. On the Amazon Connect Instances page, click on the Instance alias which you mentioned in Step 9.b. of Walkthrough.
  2. On the left pane, click on Customer Profiles.

  1. Scroll down on the Customer Profiles page. In the lower section, click on Data export & Enable data streaming.

  1. Click on the checkbox for Enable data stream, in the dropdown for Kinesis data stream, select the data stream created by CloudFormation template and noted down in Step 12. Click on Enable data streaming button.

Security Disclaimer

Please note that this solution is meant to serve as an example for how you can get started building a solution. We recommend performing additional code review, functional testing, and IT validation before releasing this solution in a production environment. Always make sure to thoroughly test your solution and follow AWS Security Best Practices.

Salesforce Validation

  1. Login to the Salesforce instance and click on Contacts.

  1. Review the details of the contact you wish to update; in this case we will be updating the Phone Number of the contact John Doe which is currently set to +15555567890 as seen in the previous image.
  2. Login to Amazon Connect Agent Workspace in a new tab.
  3. Select Customer Profile tab, you will be able to view the same user John Doe with similar detail such as Phone Number on the Agent app since Salesforce has been added as data source integration using Amazon AppFlow.

  1. Click on the Customer profile which you wish to edit, in this case we will edit the Phone number of John Doe. Click on Edit.

  1. Scroll down to the Phone Numbers section, edit the number. In this case, we have updated the number to +15555512345. Click on Save.

  1. Go back to the tab which has Salesforce instance logged in, refresh the page and review the Phone Number of the specific user, it should be updated to the new Phone Number.

  1. (Optional) You may also edit the Customer Profile using the UpdateProfile API.

 

S3 Validation

  1. Search for Amazon S3 on the AWS Console services search bar and click on S3.

  1. Search the name of S3 bucket which you created using the AWS CloudFormation template in Step 5.c. of walkthrough.

  1. Click on the bucket name, it has further sub directories based on year, month and date. You would be able to view new S3 objects created for all actions performed by you in Amazon Connect customer profile such as creation, updation or deletion.

  1. Download a file and you would be able to see the details of the event in the following format:

Clean Up

  1. Search for S3 in the AWS Console search bar. Click on S3.
  2. In S3, search the name of S3 bucket which you created using the AWS CloudFormation template in Step 5.c. of walkthrough.
  3. Select the radio button before the bucket name in the list and click “Empty” and follow the instructions in to delete all objects from the S3 bucket.

  1. Search for CloudFormation in the AWS Console search bar. Click on CloudFormation.

  1. In the CloudFormation stack search bar, search for the stack name mentioned by you in Step 4 of the Walkthrough. Click on the stack name.

  1. In the stack overview, click on the Delete.

  1. Chose Delete on confirmation pop up.

Conclusion

In this blog, we leveraged Amazon Kinesis and Amazon Connect Customer Profiles to perform real-time export of Amazon Connect Customer Profiles updates to Salesforce and Amazon S3. We demonstrated how Amazon Connect customers can maintain their source systems (e.g., CRMs and marketing systems) data up-to-date with latest updates from Amazon Connect Customer Profiles, whether its via agents updating a phone number or Customer Profiles identifying duplicates and merging profiles. 

To learn more about Amazon Connect Customer Profiles, you can read how to build unified customer profiles with Amazon Connect or watch how Choice Hotels has used Customer Profiles to build unified traveler profiles. For information about pricing see Amazon Connect Customer Profiles Pricing Page and Amazon AppFlow Pricing Page.

Author bio

Nimish Amlathe is a Senior Product Manager on the Amazon Connect team based in Seattle, Washington. Outside of work, you are likely to see him at a local comedy club.

Abhishek Pandey is a Senior Solutions Architect with Amazon Web Services based in Houston, TX. Abhishek is passionate about diving deep with customers to architect creative solutions that support business innovation across different industries. Outside of work, he loves to hang out with family and friends.
Jackysh Bangera is an Enterprise Solutions Architect with Amazon Web Services team in Mumbai. He enjoys listening to Classic Rock and you may run into him at one of the Biriyani eateries in the city.
Attila is Senior Amazon Connect Consultant with Amazon Web Services Professional Services group. Besides contact center experience, he has also had software development and enterprise networking background. Attila enjoys snowboarding and loves to explore the World with his family.
Baswaraj Thota is a Solution Architect with Amazon Web Services. With more than 15 years of IT experience, Baswaraj has helped many organizations to implement sophisticated, scalable, and secure solutions across many different industries. Outside of work, he loves to play cricket, jog and traveling.