Following guide is going to introduce how to implement functions specifically for Amazon LexV2 using Amazon Console. Continue if you are familiar and have access to Amazon Console.

The Welcome Event

The behavior of the welcome event is different depending on whether the bot is for chat and messaging. This divergence comes down to the way that each individual LivePerson product works.

A Messaging conversation qualifies as "initiated" from a Conversational Cloud perspective only after the consumer sends their first message. The consumer is prompted for their initial message in the channel they have chosen to initiate the conversation. As a result, the consumer’s first message is something that can be parsed by Lex and an intent determined.

The below documents cover where to configure the initial message on a given platform.

Platform Docs Attribute
iOS https://developers.liveperson.com/consumer-experience-ios-sdk-localizationkeys.html hiMessage
Android https://developers.liveperson.com/android-modifying-string.html#resultOverlayRecordTemplate lp_first_message
Web N/A Default LP Message
Other N/A N/A

A chat conversation is considered started when the chat is routed to an agent. the best practice is for the agent to provide the first response. In this scenario, there is no text from the consumer to parse, thus the default ‘WELCOME’ event is utilized as a starting point for the bot to prompt the user to provide input and progress the conversation.

Ensure you have an ‘entry point’ intent that utilizes the utterance ‘WELCOME-INTENT’ which will be triggered by the welcome event.

Weclome Intent example

Figure 2.1

Sending Rich Content (Structured Content)

Structured Content/Rich Content is supported by the core LivePerson platform. Documentation for the feature can be found here.

To send structured content via Lex V2, send a Customisable payload response via the intent editor as an initial or closing response.

If Images are sent in Rich content, then their URLs must be added to a whitelist via internal LivePerson configuration (Houston: messaging.rich.content.valid.urls). Please note that you must add all possible domains to this list manually as wildcards are not supported. Moreover, All domains must be HTTPS secure.

{
  "metadata": [
    {
      "type": "ExternalId",
      "id": "ABCD1234"
    }
  ],
  "structuredContent": {
    "type": "vertical",
    "elements": [
      {
        "type": "text",
        "text": "product name (Title)",
        "tooltip": "text tooltip",
        "style": {
          "bold": true,
          "size": "large"
        }
      },
      {
        "type": "map",
        "lo": 64.128597,
        "la": -21.89611,
        "tooltip": "map tooltip"
      },
      {
        "type": "button",
        "tooltip": "button tooltip",
        "title": "Navigate",
        "click": {
          "actions": [
            {
              "type": "publishText",
              "text": "my text"
            },
            {
              "type": "navigate",
              "name": "Navigate to store via image",
              "lo": 23423423,
              "la": 2423423423
            }
          ]
        }
      }
    ]
  }
}

Figure 2.2 Lex V2 Example Rich Content payload

Rich Content example

Figure 2.3 — Example in Lex Intent editor

This should contain valid structured content, along with any optional metadata required for the structured content (as seen in Figure 2.2). Always validate your structured content using this tool before entering it into the Lex V2 console.

Note: Lex supports 1000 characters per custom payload. Structured content will need to be broken down into smaller individual responses smaller if the payload is large.

Sending Quick Replies (Structured Content)

Please note Quick Replies are only supported in Messaging Conversations.

Quick Replies is a special type of Structured Content. It is a message sent along with predefined answers. For detailed information on Quick Replies check out the documentation for the specific channel (Mobile SDK and Web, Facebook Messenger, Google RCS Business Messaging).

{
  "structuredContent": {
    "quickReplies": {
      "type": "quickReplies",
      "itemsPerRow": 8,
      "replies": [
        {
          "type": "button",
          "tooltip": "yes I do",
          "title": "yes",
          "click": {
            "actions": [
              {
                "type": "publishText",
                "text": "yep"
              }
            ],
            "metadata": [
              {
                "type": "ExternalId",
                "id": "Yes-1234"
              }
            ]
          }
        },
        {
          "type": "button",
          "tooltip": "No!",
          "title": "No!",
          "click": {
            "actions": [
              {
                "type": "publishText",
                "text": "No!"
              }
            ],
            "metadata": [
              {
                "type": "ExternalId",
                "id": "No-4321"
              }
            ]
          }
        }
      ]
    },
    "message": "Do you like Bots?"
  },
  "metadata": [
    {
      "id": "1234",
      "type": "ExternalId"
    }
  ]
}

Figure 2.4 QuickReplies Structured Content example payload

Sending Image Card Response (Structured Content)

A card group is a Native feature by Lex and it contains a set of cards. A card contains an image, a title, a subtitle, and up to six buttons. You can have up to three cards in a card group. Please note that Amazon Lex will select one of the cards during a conversation as a response.

Image Card example

Figure 2.5 — Image card example in Lex Intent editor

Bot Actions

Please note we only support ONE ACTION per response

Transfer / Escalations

If the bot needs to transfer the conversation to a human agent, or the conversation flow indicates that another bot is better suited for the identified intent, you will need to tell the connector to transfer the conversation to a given skill.

This is achieved using a "Customisable payload" in any response section of a Lex intent editor.

Multiple scenarios for transfer/escalations exist triggered by the transfer action object.

  1. Explicit request from a visitor to transfer to an agent (e.g., action: transfer)

  2. If the Bot does not have an appropriate answer, it should recognise this as a scenario for a transfer. Depending on the connector configuration or the decision-making capacity of the bot, the bot will transfer to a particular skill or default skill.

  3. If there is an internal error or the bot service cannot be reached the connector will transfer to a default skill set up during configuration.

Transfers and escalations rely on the action item in the response object.

Transfer To Skill

This option transfers the conversation to the next available agent using the provided skill.

{
  "type": "ACTION",
  "params": {
    "action": "TRANSFER",
    "data": {
      "skill": "target-skill-name"
    }
  }
}

Transfer to skill example

Figure 2.6 — Example in Lex Intent editor

Transfer to Agent

This feature is depending on permissions

This option transfers the conversation to the particular agent matching the provided agentId and skill. If the agent is not available, the conversation will be transferred to an available agent with the same skill

{
  "type": "ACTION",
  "params": {
    "action": "TRANSFER",
    "data": {
      "skill": "human_skill",
      "agentId": "4129463410"
    }
  }
}

Transfer to an agent example

Figure 2.7 — Transfer example in Lex Intent editor

Close Conversation

In the bot’s flow, there will be times when it is appropriate to end the conversation without escalating to a live agent. If a query has been answered, or the brand has determined that no escalation is required for a given query, then it is best practice to have the bot end the conversation.

The method for closing a conversation is similar to the transfer action in that the same "Actions and Parameters" field is utilised in the Lex Intent editor.

The action field needs to be set to CLOSE_CONVERSATION to instruct the connector to close the conversation.

{
  "type": "ACTION",
  "params": {
    "action": "CLOSE_CONVERSATION"
  }
}

close conversation

Figure 2.8 — close conversation example in Lex Intent editor

To close the conversation without triggering the post conversation survey use the following payload

{
  "type": "ACTION",
  "params": {
    "action": "CLOSE_CONVERSATION",
    "data": {
      "withoutPcs": true
    }
  }
}

Change Time To Response of Conversation

Change the TTR of a conversation based on the action value in the response object.

LivePerson Messaging uses 3 different types of priorities:

  • "URGENT"
  • “NORMAL”
  • “PRIORITIZED”

The time values of these are defined in the Agent Workspace.

{
  "type": "ACTION",
  "params": {
    "action": "CHANGE_TTR",
    "data": {
      "ttrType": "URGENT"
    }
  }
}

Change TTR

Figure 2.9 — Change time to response example in Lex Intent editor