Customize chat flow experiences by integrating custom participants
You can integrate other solutions, such as bots, with Amazon Connect chat to create customized chat flow experiences.
Following is an overview of how you can customize your chat flow experience. Implement these steps for each chat segment after the chat conversation is started. We recommend adding an Invoke AWS Lambda function block to call the APIs in your chat flow.
Important
Add a Play prompt block before a Invoke AWS Lambda function block. This is required only when an Invoke AWS Lambda block is the first block in your inbound chat flow.
-
Call the Amazon Connect CreateParticipant API to add a custom participant (
ParticipantRole
=CUSTOM_BOT
) to the chat contact.-
For information about how to create the SDK client for calling Amazon Connect APIs, see the following topics:
-
Keep the
ParticipantToken
that is obtained from CreateParticipant to call CreateParticipantConnection.CreateParticipantConnection
returns aConnectionToken
, which you can use to call other Amazon Connect Participant APIs.When calling CreateParticipantConnection to create a connection for a custom participant:
-
Set
ConnectParticipant
toTrue
to mark the custom participant as connected for message streaming. -
Pass
Type
asCONNECTION_CREDENTIALS
to call the subsequent Amazon Connect Participant Service APIs. -
CreateParticipantConnection
should be called within 15 seconds of callingCreateParticipant
.
-
-
-
After the participant is added to the contact, they can exchange messages with the customer by using Amazon Connect Participant Service APIs.
-
To disconnect the participant, call the DisconnectParticipant API.
Note
-
A custom participant cannot be added to a chat when an agent or Amazon Lex bot is already present on the contact.
-
A custom participant will be disconnected when an agent or Amazon Lex bot joins a contact.
-
Only one custom participant can be present on a contact.
We recommend configuring how long a custom participant can chat with a contact:
-
Set the Timeout property on the Wait block for the
ParticipantRole
=CUSTOM_BOT
. -
If the custom bot participant is not disconnected before the timeout, then the contact is routed down the Time Expired branch. This allows you to decide which block to run next to resolve the customer's query.
Note
If a contact is routed down the Time Expired branch, they are not disconnected from the contact. You must call the DisconnectParticipant API to disconnect the participant.
Troubleshooting tip
If you get a ResourceNotFoundException
for the custom participant when
calling the CreateParticipantConnection
API, check whether the
CreateParticipantConnection
API was called within 15 seconds of
CreateParticipant
API.