Let the platform do the work

Amazon Connect Deployment Guide for SugarLive

Overview

To use some of the features in Sugar Serve and Sell, you must perform specific steps in Amazon Web Services (AWS) using the files provided in the zip file available for download from your account's Downloads page. However, please note that SugarLive is a robust product and the external configuration that it requires in AWS is outside of Sugar's typical scope of support

This guide covers the setup on the Amazon side for SugarLive and Sugar Portal Chat features. To use each of these five features, you must first complete the steps in the Creating the AWS CloudFormation Stack section and then the appropriate section for the feature after that:

See the Amazon Connect Settings page for details on setting up these features in Sugar. 

Prerequisites

To walk through this guide, you must already have an Amazon Connect instance and a Sugar instance. To successfully create an Amazon Connect instance and the S3 bucket required by many of the SugarLive features, your AWS account must have the "AmazonConnect_FullAccess" policy attached in the IAM console on Amazon's website. To attach the "AmazonConnect_FullAccess" policy, see this article on Amazon's website: Adding and removing IAM identity permissions.

Note: SugarLive and Sugar Portal Chat can only be used with certain web browsers. For more information, refer to the Supported Platforms page.

Upgrading the SugarLive Package

v1.4 of the package updates the following files:

  • Lambda-v1.3.zip
  • README.pdf

If you are using the files in v1.3 of the zip file, follow these steps to start using v1.4:

  1. Upload the new Lambda-v1.3.zip file to your S3 bucket.
  2. Update your CloudFormation stack parameters by clicking Update > Use current template > Next.
  3. Update the InstallationFile parameter to be the Lambda zip file you just uploaded, including the path within the bucket.
  4. All other settings can be left as is. Click "Next" on this page and the following page and then enable the checkbox at the bottom before clicking "Update stack".

Creating the AWS CloudFormation Stack

  1. Open Amazon S3 and either create a new S3 bucket or use an existing bucket.
  2. Upload Lambda-v1.3.zip to a location within the S3 bucket.
  3. Open AWS CloudFormation > Create Stack > With new resources.
    create stack
  4. Select "Upload a template file" and upload CloudFormation_Template-v1.3.yml. Click "Next".
  5. Enter a stack name.
  6. Populate the following parameters:
    1. InstallationS3BucketName: The bucket name created or selected in step 1
    2. InstallationFile: The file, including the path within the bucket, uploaded in step 2

      1. An easy way to find this value is to open the created object in step 2 and find the key

        object overview

        Note: The remaining parameters can be skipped at this time. You will insert values for them as needed when setting up specific features in the below sections. If you want to set them now for the features you plan to use, see the following sections for the required parameters:

  7. Click "Next" and leave the Configure Stack Options and Advanced Options sections as is.

  8. Click "Next" and enable the checkbox under the Capabilities section at the bottom.

    capabilities
  9. Click "Create stack". This may take a few minutes and you can refresh the Events tab of the stack to monitor the progress

Once the stack is ready, you can proceed to one of the below sections in this guide to set up certain SugarLive features.

Creating the AWS Secret

An AWS secret holding the credentials for your Sugar instance is required when setting up all of the SugarLive features. Use the following steps to create a secret that can be used in your CloudFormation stack:

  1. Open AWS Secrets Manager, click "Store a new secret", then select "Other type of secrets" as the secret type.

  2. Add two rows in the Secret Key/Value tab and populate them with the sugarUsername and sugarPass keys listed below with their values. 

    1. sugarUsername: The username of a Sugar user that AWS Lambda will use to access Sugar. This user should have the privileges required to perform the necessary actions in Sugar (e.g., update call records to save the call recording URL).

    2. sugarPass: The password of the provided Sugar user

       

      secret

       

    3. Click "Next" and provide a name for the secret. Click "Next" again and then "Store".

Setting up Call Recording

  1. Follow the instructions in the Creating the AWS CloudFormation Stack section.

  2. Follow the instructions in the Creating the AWS Secret section to create a secret. Note its ARN, which you will copy and paste into the CloudFormation stack in a later step.

  3. Once the stack has been created, update the stack parameters with more values by clicking Update > Use current template > Next.

    qa-testing-stack
  4. Enter values for the following parameters that are required for call recording:

    1. EnableCallRecordingLink: "true"

    2. AWSConnectInstanceName: The instance name of your Amazon Connect instance (i.e. the first part of your instance's URL)

    3. AWSConnectDomain: The domain of your Amazon Connect instance (e.g. "my.connect.aws")
    4. CallRecordingPartialURL: The partial URL used to construct call recording links. This value should not be changed from the default value unless AWS updates how call recording links are generated.

    5. SugarURL: The URL of your Sugar instance

    6. SugarSecretARN: The ARN of the secret you created

  5. All other settings can be left as is. Click "Next" on this page and the following page and then enable the checkbox at the bottom before clicking "Update stack".

  6. Next, add an S3 trigger to the Call Recording Lambda function by opening the Resources tab of the stack and searching for "callrecording".

    call-recording
  7. Click on the link in the Physical ID column for the function that is returned. It will open the Lambda function in a new tab.

  8. In the Lambda function, click "Add trigger".

    add-trigger
  9. Search for S3 and select it.

    s3
  10. Fill out the fields that appear with the following values:

    1. Bucket: The name of the bucket used by your Amazon Connect instance. To find it, open Amazon Connect > your instance > Data storage and copy the bucket name from the path where call recordings will be stored.

      bucket
    2. Event type: "All object create events"

    3. Prefix: "connect/<your-connect-instance-name>/CallRecordings/"

    4. Suffix: Leave this field blank.

  11. Enable the checkbox at the bottom and click "Add". If you see the following error, an S3 trigger with the same prefix or suffix has already been added to the bucket:

    an-error-occured
  12. Then, in your Amazon Connect instance, ensure that your contact flows have call recording enabled by adding a "Set recording and analytics behavior" block and turning on call recording within it.

    set recording

    Note: Be sure to do this for every contact flow that you want to enable call recordings for (e.g. the inbound and outbound flows).

  13. Save and publish the contact flows.

After completing these steps, the link to the call recording will be stored in the Recording field on the call record for calls completed in SugarLive that use one of the contact flows you configured. Note that the link will be immediately saved but the audio file may take a few minutes to become available at that link after you have cleared the contact in SugarLive.

Setting up Call Transcripts and Sentiment Analysis

  1. Follow the instructions in the Creating the AWS CloudFormation Stack section.

  2. Follow the instructions in the Creating the AWS Secret section to create a secret. Note its ARN, which you will copy and paste into the CloudFormation stack in a later step.

  3. Once the stack has been created, update the stack parameters with more values by clicking Update > Use current template > Next.

    qa-testing-stack
  4. Enter values for the following parameters that are required for call transcripts:

    1. EnableCallTranscriptUpload: "true"

    2. SugarURL: The URL of your Sugar instance

    3. SugarSecretARN: The ARN of the secret you created

  5. All other settings can be left as is. Click "Next" on this page and the following page and then enable the checkbox at the bottom before clicking "Update stack".

  6. Next, add an S3 trigger to the Contact Lens Lambda function by opening the Resources tab of the stack and searching for "savecalltranscript".

    save-call-transcript
  7. Click on the link in the Physical ID column for the function that is returned. It will open the Lambda function in a new tab.

  8. In the Lambda function, click "Add trigger".

    add-trigger2
  9. Search for S3 and select it.

    s3
  10. Fill out the fields that appear with the following values:

    1. Bucket: The name of the bucket used by your Amazon Connect instance. To find it, open Amazon Connect > your instance > Data storage and copy the bucket name from the path where call recordings are stored.

      bucket
    2. Event type: "All object create events"

    3. Prefix: "Analysis/"

    4. Suffix: Leave this field blank.

  11. Enable the checkbox at the bottom and click "Add". If you see the following error, an S3 trigger with the same prefix or suffix has already been added to the bucket:

    an-error-occured
  12. Then, in your Amazon Connect instance, ensure that your contact flows have Contact Lens enabled by adding a "Set recording and analytics behavior" block if one has not already been added. Turn on call recording and Contact Lens speech analytics within it. Contact Lens call transcripts cannot be enabled unless call recordings are enabled in the contact flow first.

speech-analytics

Note: Be sure to do this for every contact flow that you want to enable call transcripts and sentiment analysis for (e.g. the inbound and outbound flows).

After completing these steps, the transcript will be stored in the Transcript field on the call record for calls completed in SugarLive that use one of the contact flows you configured. The customer and agent sentiment will also be stored in the Customer Sentiment and Agent Sentiment fields on the call. These fields are not displayed by default but can be added to your record and list view layouts using Studio. Note that it may take a while for Contact Lens to process the transcript and sentiment analysis and it will take more time for longer calls.

Setting up Sugar Portal Chat

  1. Follow the instructions in the Creating the AWS CloudFormation Stack section.

  2. Follow the instructions in the Creating the AWS Secret section to create a secret. Note its ARN, which you will copy and paste into the CloudFormation stack in a later step.

  3. In your CloudFormation stack, update the stack parameters with more values by clicking Update > Use current template > Next.

    qa-testing-stack
  4. Enter values for the following parameters that are required for Sugar Portal Chat:

    1. EnableSugarPortalChat: "true"

    2. AmazonConnectInstanceID: The ID of your Amazon Connect instance. To find it, open Amazon Connect > your instance > Overview and copy the last part of the instance ARN (i.e. everything after "instance/").

      url3
    3. ContactFlowID: The ID of the contact flow you wish to use in Sugar Portal Chat. If you plan to use the sample contact flow and chatbot included with Sugar Serve, you can enter a dummy value for now. You will update this when completing the steps to set up the chatbot later. To find the ID of a contact flow, click "Show additional flow information" on the left of your contact flow and copy the last part of the ARN (i.e. everything after "contact-flow/").

      contact-flow
    4. SugarURL: The URL of your Sugar instance

    5. SugarSecretARN: The ARN of the secret you created

  5. All other settings can be left as is. Click "Next" on this page and the following page and then enable the checkbox at the bottom before clicking "Update stack".

  6. In your Sugar instance, open Admin > Amazon Connect Settings > Sugar Portal Chat tab to configure the following portal chat settings:

    1. Enable Amazon Connect Chat: "true"

    2. API Gateway: The Invoke URL for the API gateway you are using.

      1. To find it, search for "api" in the Resources tab of your stack and click the link in the Physical ID column of the StartChatAPIGateway value. This will open the API gateway in a new tab.

        Resources
      2. From there, open Stages > Prod and copy the Invoke URL to paste in Sugar.

        stages-prod
    3. Contact Flow ID: The ID of the contact flow you wish to use in Sugar Portal Chat. This is the same value you entered in the ContactFlowID parameter in your stack.

    4. Amazon Connect Instance ID: The ID of your Amazon Connect instance. To find it, open Amazon Connect > your instance > Overview and copy the last part of the instance ARN (i.e. everything after "instance/"). This is the same value you entered in the AmazonConnectInstanceID parameter in your stack.

      url3
  7. Save your changes to the Amazon Connect Settings page.

  8. If you have not already, enable the portal under Admin > Sugar Portal > Configure Portal.

After completing these steps, Sugar Portal Chat will be enabled for your Sugar instance and the chat window will appear for customers using the portal to connect to an agent. If you wish to also set up the chatbot, continue to the Setting Up the Chatbot in Sugar Portal Chat section.

Setting up the Chatbot in Sugar Portal Chat

  1. Follow the instructions in the Creating the AWS CloudFormation Stack section.

  2. Follow the instructions in the Setting up Sugar Portal Chat section.

  3. Unzip the Portal_Chat.zip file. In your Amazon Connect instance, open Routing > Contact flows > Create contact flow > Import flow and select the portal chat contact flow

    in the unzipped Portal_Chat directory (e.g. SugarCRM_Portal_Chat_Contact_Flow-v1.0).

    import-flow
  4. Save the contact flow. There is no need to publish it yet because we will publish it after making further changes later.

  5. In your CloudFormation stack, update the stack parameters with more values by clicking Update > Use current template > Next.

    qa-testing-stack
  6. Enter values for the following parameters that are required for the Sugar Portal Chat chatbot. Most values will already be accurate, but at a minimum, you will need to update the ContactFlowID parameter to use the sample contact flow included with Sugar Serve:

    1. EnableSugarPortalChat: "true"

    2. AmazonConnectInstanceID: The ID of your Amazon Connect instance. To find it, open Amazon Connect > your instance > Overview and copy the last part of the instance ARN (i.e. everything after "instance/").

      url3
    3. ContactFlowID: The ID of the contact flow you imported in step 3. To find the ID, click "Show additional flow information" on the left of your contact flow and copy the last part of the ARN (i.e. everything after "contact-flow/").

      contact-flow
    4. SugarURL: The URL of your Sugar instance

    5. SugarUsername: The username of a Sugar user that AWS Lambda will use to access Sugar

    6. SugarPassword: The password of the provided Sugar user

  7. All other settings can be left as is. Click "Next" on this page and the following page and then enable the checkbox at the bottom before clicking "Update stack".

  8. Next, in Amazon Lex, open Actions > Import and import SugarServeSampleBot.zip, which can be found in the unzipped Portal_Chat directory. Note that if you have not created a Lex bot before, you may be directed to the Get Started page at first. If so, you will need to click "Get Started" and then "Cancel" to get to the main console. In addition, there are two different versions of the Lex console. The Lex bot provided by Sugar is only compatible with the V1 console, so be sure to switch to the V1 console before importing:
    LexBotConsole

    Note: If you have imported the sample bot before, uploading it again will overwrite the previous one. To avoid this, rename the sample bot before importing it by unzipping the bot, opening the JSON file, and changing the "name" value of the "resource" entry to something unique. Then, zip the updated JSON file and import that zip file instead.

  9. Open the imported Lex bot > Editor tab > the "sugarFallback" intent > Fulfillment and select "AWS Lambda function". In the Lambda Function field that appears, select the "<your-stack-name>-LexGetStringFunction" function. Once done, click "Save Intent".
    fallback-again

    fallback
  10. Click "Build" to build the Lex bot. When that is complete, click "Publish" and enter the bot name as the alias (e.g. "SugarServeSampleBot").

  11. Then, open Amazon Connect > your instance > Contact flows and select the newly-created Lex bot under the Amazon Lex section.

    contact-flows
  12. Click "Add Lex Bot" to add it.

    add-lex-bot
  13. Under the AWS Lambda section, add the following Lambda functions:

    1. <your-stack-name>-CaseStatusFunction

      add-lambda
    2. <your-stack-name>-CreateCaseFunction

      add-lambda-2

  14. Next, open your Amazon Connect instance and open the contact flow you imported in step 3. There should be three "Get customer input" blocks. 
    get-customer-input
    In each of these three blocks, select the newly-created Lex bot under the Amazon Lex section and save.
    Serve-Sample-bot

  15. Find the "Invoke AWS Lambda function" block of the getCase flow by following the arrow from the "getCase" option in the first "Get customer input" block through to the first "Invoke AWS Lambda function" block. It should be at the top of the contact flow. Open it and select the <your-stack-name>-CaseStatusFunction Lambda function in the Select a Function field. Save the block.

    invoke-lambda-functionselect-a-function
  16. Find the other "Invoke AWS Lambda function" block, which is the one that comes after the "Transfer to flow" block. Open it and select the

    <your-stack-name>-CreateCaseFunction Lambda function in the Select a Function field. Save the block.

  17. Find the "Transfer to flow" block and open it. Select "Sample queue configurations flow" in the Select a Flow field and save.

    resolved-resource
  18. Save the contact flow and then publish it.

  19. In your Sugar instance, open Admin > Amazon Connect Settings > Sugar Portal Chat tab to configure the following portal chat settings. Most values will already be accurate, but at a minimum, you will need to update the Contact Flow ID field to use the sample contact flow included with Sugar Serve:

    1. Enable Amazon Connect Chat: "true"

    2. API Gateway: The Invoke URL for the API gateway you are using.

      1. To find it, search for "api" in the Resources tab of your stack and click the link in the Physical ID column of the StartChatAPIGateway value. This will open the API gateway in a new tab.

        resources-3
      2. From there, open Stages > Prod and copy the Invoke URL to paste in Sugar.

        stages-prod
    3. Contact Flow ID: The ID of the contact flow you imported in step 3. This is the same value you entered in the ContactFlowID parameter in your stack.

    4. Amazon Connect Instance ID: The ID of your Amazon Connect instance. To find it, open Amazon Connect > your instance > Overview and copy the last part of the instance ARN (i.e. everything after "instance/"). This is the same value you entered in the AmazonConnectInstanceID parameter in your stack.

      url3
  20. Save your changes to the Amazon Connect Settings page.

  21. If you have not already, enable the portal under Admin > Sugar Portal > Configure Portal.

After completing these steps, the chatbot will be enabled in Sugar Portal Chat for your Sugar instance. Customers using the portal can work with the chatbot or connect to an agent in the portal chat window.

Setting up an External Chat Window

If you prefer, you can set up an external chat window on your own hosted website, as opposed to using the Sugar Portal. From there, you can configure the contact flow in your Amazon Connect instance to set several attributes. These attributes are read by SugarLive and can be used to open relevant customer data in the Detail panel when the chat session starts. The following attributes are available to be set: 

  • sugarCaseNumber: The unique number assigned to the case 
  • sugarContactId: The record ID of the contact
  • sugarContactEmail: The primary email address of the contact
  • sugarContactName: The first and last name of the contact

They are read in the above order, which means that SugarLive opens the record(s) that match the first provided attribute.

If SugarLive receives a chat with any of these attributes, it opens the matching case and contact records in the Detail panel. If more than one contact matches (e.g., via name or email), they are opened in the Search tab instead so the agent can select the correct one to open. See the contact attributes documentation on Amazon's website for more details on how to use attributes in your contact flows.