Amazon Connect Worker

Type: Amazon Connect Worker

An Amazon Connect worker will route a conversation to a live agent in Amazon Connect. If messages come in outside of the configured business hours automated messages from connect will respond to the user. A connect worker can be created through the CLI or as part of a bot through the Amazon Connect Blueprint.

Note: Amazon Connect workers cannot be interacted with directly by users, they must be transferred to an agent on Amazon Connect through a flow worker first.

Secrets

An AWS cross-account role is required in order to access Amazon Connect. Please see cross-account roles for more information. The secret will need amazon connect readonly permissions.

Other Amazon Connect fields

  • ContactFlowId: Flow in amazon connect that will be initiated
  • InitialConnectionMessage: Configuration needed for Amazon Connect. Do not change.
    • Default: "{\"topic\":\"aws/subscribe\",\"content\":{\"topics\":[\"aws/chat\"]}}"
  • InstanceId: Instance of amazon connect
  • Region: Region where the Amazon Connect bot is configured.
  • Secret: Cross-account role secret.

Creating an Amazon Connect worker through cli

Save this json to a file and create a worker using the cli command sb-cli worker create file.json. Note to replace the values for Secret, Region, InstanceId, InitialConnectionMessage, and ContactFlowId.

{
  "Data": {
    "ContactFlowId": "GUID for Contact Flow ID",
    "InitialConnectionMessage": "{\"topic\":\"aws/subscribe\",\"content\":{\"topics\":[\"aws/chat\"]}}",
    "InstanceId": "GUID for Connect Instance ID",
    "Region": "us-east-1",
    "Secret": "srn:vault::ORG:aws-cross-account-role:SECRETALIAS",
    "IngressTranslateApi":"IngressTranslateBaas",
    "EgressTranslateApi":"EgressTranslateBaas",
    "SlashCommands": {
      "/welcome": {
        "actions": [{
            "type": "content",
            "value": "welcomewithname"
          },
          {
            //Another valid botnet action
          }
        ],
        "description": "A welcome message with the users name"
      }
    }
  },
  "Description": "Worker that routes to livechat agents",
  "Enabled": true,
  "Name": "ConnectOne",
  "Type": "amazon-connect-worker"
}

Once you have created the worker using the CLI, it will return an ID for you. You need to then update/create a bot and place the filter worker at the top with the id and the type of amazon-connect-worker

Creating and setting up an Amazon Connect worker with a Blueprint

  1. Create a contact flow on AWS Connect

    1. Go to the Amazon Connect console.
    2. Select ‘Contact Flows’ under ‘Routing’ on the dropdown menu on the left.
    3. Click the ‘Create contact flow’ button.
    4. Create a contact flow such as the following:
  2. Build your bot

    1. Navigate to the Bot designer and click “Create Bot”.
    2. Select the “Amazon Connect Bot” Blueprint.
    3. Enter a name for the bot. This name will be given to the flow worker bot. The bot with the connect worker will have the same name with “ConnectBot” appended to it.
    4. Enter a description, which is given to both bots.
    5. Under “Amazon Connect Configuration”, enter a region, connect instance ID, a contact flow ID, and a secret.
      • The instance ID and contact flow ID can be found in the URL of the contact flow page from earlier.
      • E.g. …/instance/123a456b-123a-456b-789c-0123456789ab/contact-flow/987z654y-987z-654y-321x-9876543210zy
    6. Build it!
  3. Test and adjust your bot

    1. Find the flow bot (not the connect bot) that was created in Bot Army and open its test page.
    2. Go to Amazon Connect and click the phone button to open a chat window.
    3. Send the bot a message through its test page.
    4. If the flow triggers a human handover, a notification will appear in the Amazon Connect chat window, prompting the user to connect to the bot, and a conversation is started.

Sample Baas for translation

Below is an example of the inbound translate.

{
  "Headers": {
    "content-type": "application/json"
  },
  "Organization": "shane",
  "Description": "Translate Language",
  "RequestMapping": {
    "Text": {
      "type": "requestBody",
      "requestBodyPath": "$.Text",
      "inputPath": "$.Text"
    }
  },
  "ResponseMapping": {},
  "Type": "aws-sdk",
  "Body": {
    "TargetLanguageCode": "en",
    "SourceLanguageCode": "es"
  },
  "Credentials": "srn:vault::YOURORG:secretdoc:translatesecret",
  "Method": "translateText",
  "Endpoint": "Translate",
  "Alias": "ConnectInbound",
}