Newer Version Available
Service Cloud Voice Aura Toolkit API Conversation Events
Listen to events related to a conversation.
The following conversation events are available.
| Event Name | Description |
|---|---|
| FLAG_RAISE | Sent when an agent, while communicating with a customer, quietly raises a flag to get help from a supervisor. |
| FLAG_LOWER | Sent when an agent or supervisor lowers a raised flag to cancel the request for supervisor help. |
| NOTE | Sent when an agent or supervisor sends a message without raising a flag. For example, an event is sent when a user jots down notes but doesn't raise a flag. |
| TRANSCRIPT | Sent when a new utterance is received by the transcription system. |
To subscribe to an event, add a conversation event listener. For example, add the following event listener to subscribe to the TRANSCRIPT event:
1// Subscribe
2cmp.find('voiceToolkitApi')
3 .addConversationEventListener('TRANSCRIPT', conversationEventListenerFunc);
4
5// Unsubscribe
6cmp.find('voiceToolkitApi')
7 .removeConversationEventListener('TRANSCRIPT', conversationEventListenerFunc);You can add multiple conversation event listeners. For example, you can add the following event listeners to subscribe to all the events related to raising and lowering flags:
1// Subscribe
2cmp.find('voiceToolkitApi')
3 .addConversationEventListener('FLAG_RAISE', conversationEventListenerFunc);
4 .addConversationEventListener('FLAG_LOWER', conversationEventListenerFunc);
5
6// Unsubscribe cmp.find('voiceToolkitApi')
7 .removeConversationEventListener('FLAG_RAISE', conversationEventListenerFunc);
8 .removeConversationEventListener('FLAG_LOWER', conversationEventListenerFunc);When an event occurs, you receive a JSON payload that contains the event type, along with any relevant data. For instance:
1{
2 "type": "TRANSCRIPT",
3 "detail": {
4 "id": "3115b389-ab50-400e-b8ba-978b7ec51d7a"
5 "clientSentTimestamp": 1594944652299,
6 "serverReceivedTimestamp": 1594944652328,
7 "content":{
8 "formatType": "Text",
9 "text": "Hello"
10 },
11 "callId": "c5d93c19-e03b-44f8-85e6-a11f02e70c45",
12 "sender": {
13 "role": "Agent"
14 }
15 }
16}The following table describes all the payload properties.
| Property Name | Type | Description |
|---|---|---|
| type | string | The type of conversation event. |
| detail | object | Identifying information associated with this voice call event. |
| detail.id | string | Unique identifier for the message. |
| detail.clientSentTimestamp | number | The date and time (in UTC) when the client sent the content. Measured in milliseconds since the Unix epoch. |
| detail.serverReceivedTimestamp | number | The date and time (in UTC) when the server received the content. Measured in milliseconds since the Unix epoch. |
| content | object | Information about the content. |
| content.formatType | string | The content format type of the raised flag, note, or transcript. Possible value is “Text.” |
| content.text | string | The body text of the raised flag, note, or transcript. |
| callId | string | The unique ID of the voice call within the telephony system. For example, if the telephony system is Amazon Connect, this value is the contact ID. |
| sender | object | Information about the user whose action initiated the event. |
| sender.role | string | The role of the user whose action initiated the event. Possible values are "Agent" and "Supervisor". |
| sender.displayName | string | The name of the user whose action initiated the event. |