Engage for Amazon Connect can display custom attributes in the Side Panel that reflect up-to-date Contact information from your Salesforce CRM. This information can be retrieved automatically using the sfInvokeAPI Lambda function that's provided with the AWS Serverless Application package, as part of the Amazon Connect and Salesforce CRM integration.

Additionally, the View in CRM button can be made a clickable link to pop-open a new tab directly to the Contact in Salesforce for further context.

By deploying the Salesforce integration and customizing your Amazon Connect Contact Flows, you can greatly increase the up-to-date customer detail available at your agent's fingertips, saving time and improving efficiency.

Here's what the Salesforce Contact looks like:

Engage for Amazon Connect side panel:

In this article, you will setup a Salesforce CRM data dip that does the following in Amazon Connect for your standard Chat Contact Flow:

  • Use the customer-provided email address to lookup a matching Contact in Salesforce, pulling the Name, Phone, Title, Department and linked Account Name fields for the Contact.
  • Set each of the Contact fields as contact attributes that will appear in the side panel of Engage for Amazon Connect.
  • Set a special crm_link attribute to the full URL of the Salesforce Contact to activate the View in CRM button in the side panel of Engage for Amazon Connect.

Prerequisites

Prior to building the Salesforce CRM data dip in Amazon Connect, you will need to install two crucial components of the Amazon Connect CTI integration into your Salesforce CRM and AWS accounts:

  1. Salesforce Package: Use this to setup Access Permissions in Salesforce CRM. You do not need to go through the configuration of the Lightning Experience or Initial CTI Adapter configuration.
  2. AWS Serverless Application: Install the Lambda functions into your AWS account to enable API connectivity and lookup functionality to your Salesforce CRM.

Be sure to install both of these packages carefully and test the integration before moving forward. Specifically, make sure you test the validate core functionality by testing the sfInvokeAPI Lambda function installed by the AWS Serverless Application package (above). You should be able to successfully do a simple phone number lookup from Lambda for a Salesforce Contact.

Add a custom Lambda function for setting 'View in CRM' URL

In order to configure the 'View in CRM' button in the Side Panel, you will need to set a special crm_link attribute in your Contact Flow that sets the URL as its value. To do this, you will create a simple Lambda function that accepts the Salesforce account, object type and object ID and returns the a full URL to the Contact Flow.

https://.lightning.force.com/lightning/r///view

Create the Lambda function

  1. Login to your AWS account as an administrator.
  2. Go to Lambda > Create Function.
  3. Create a new function, author from scratch:
    - Function name: salesforce-url
    - Runtime: Python 3.8
  4. In the lambda_function.py file, delete any code and paste the following:
def lambda_handler(event, context):
   SFDCAccount = event['Details']['Parameters']['account']
   SFDCObject = event['Details']['Parameters']['object']
   SFDCId = event['Details']['Parameters']['id']
   SFDCURL = 'https://' + SFDCAccount + '.lightning.force.com/lightning/r/' \
             + SFDCObject + '/' + SFDCId + '/view'
   return {
       'statusCode': 200,
       'body': SFDCURL
   }

Add the Lambda function to Amazon Connect

  1. In your AWS account, go to Amazon Connect and open the Instance Alias that's integrated with Engage for Amazon Connect.
  2. On the left, click Contact Flows.
  3. Under AWS Lambda, select the new function you just created and click + Add Lambda Function.

Add Flow Blocks to your Chat Contact Flow

In Amazon Connect, you will need to update your Contact Flow used for handling inbound Chat for Engage for Amazon Connect (web chat, email, Twitter, Facebook, etc.).

Where you add and connect Flow Blocks within your Contact Flow will vary for each customer and is dependent on the unique aspects of your chat contact routing. Ideally, you'll want to place these additional Flow Blocks after you have received an email address from the customer but before you've set or transfer them to a Queue.

The summary of additional Flow Blocks you need to add and connect the Success outputs together are as follows:

  1. Invoke AWS lambda function: you will invoke the sfInvokeAPI function for Contact lookup (to find a matching Contact based on their email address), using multiple input parameters for email, sf_operation, sf_object and sf_fields.
  2. Set contact attributes: from the sfInvokeAPI function response, immediately set attribute values for customer_name, phone, title, department and _hidden_accountid.
  3. Invoke AWS Lambda function: next you will invoke the sfInvokeAPI function again, except this time for Account lookup (to get the name), using multiple input parameters: sf_operation, sf_object, sf_fields, Id.
  4. Set contact attributes: from the sfInvokeAPI function response, immediately set an attribute value for account_name.
  5. Invoke AWS Lambda function: next you will invoke the salesforce-url function you created, using multiple input parameters for Salesforce object, account and Contact id.
  6. Set contact attributes: from the salesforce-url function response, immediately set the attribute value for crm_link.

The six Flow Blocks in your Contact Flow should look similar to this:

Note that if any of the three Lambda functions return null values for any of the fields provided, the contact attributes will still be created and shown in the Side Panel, but with empty values.

The detailed configuration of each of the six Flow Blocks (above) are as follows:

1. Invoke AWS Lambda function

Salesforce Contact lookup.


2. Set contact attributes

Set Salesforce Contact fields as attributes.

3. Invoke AWS Lambda function

Salesforce Account lookup.

4. Set contact attributes

Set Salesforce Account name as attribute value.

5. Invoke AWS Lambda function

Create full URL to Salesforce Contact.

6. Set contact attributes

Set Salesforce Contact URL as crm_link attribute value.

Looking for more resources for Engage for Amazon Connect? Partners and customers can check out our Resources Center.