Salesforce Voice Aura Toolkit API Conversation Events
The following conversation events are available.
| Event Name | Description |
|---|---|
| FLAG_RAISE | Sent when a rep, while communicating with a customer, quietly raises a flag to get help from a supervisor. |
| FLAG_LOWER | Sent when a rep or supervisor lowers a raised flag to cancel the request for supervisor help. |
| NOTE | Sent when a rep 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. |
| INTELLIGENCE_SIGNAL | Sent when a new intelligence signal is received. This event isn't supported in Salesforce Voice (Native Telephony). |
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 the payload properties for the FLAG_RAISE, FLAG_LOWER, NOTE, and TRANSCRIPT events:
| 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. |
| voiceCallId | string | Unique identifier of the Salesforce voice call in which a rep raised or lowered the flag. For transferred calls, the new call segment has a different voiceCallId from the original call. |
The following table describes the payload properties for the INTELLIGENCE_SIGNAL event:
| Property Name | Type | Description |
|---|---|---|
| type | string | The type of conversation event. |
| detail | object | Identifying information associated with this voice call event. |
| detail.events | string | A piece of signal data generated in real time from a voice call between a rep and end user. Events must be sorted in chronological ascending order by startTime. For example, the following snippet displays a piece of signal data. See detail.events. |
| event.service | number | The intelligence source of the events. Possible values are:
|
| event.type | number | The signal type of the event. Possible values are:
|
| event.value | object | The value of the signal generated in real time by the telephony vendor. For example, this could be a Contact Lens rule defined in Amazon Connect. |
| event.startTime | string | The date and time (in UTC) when this event started. Measured in milliseconds since the Unix epoch. |
| event.endTime | string | The date and time (in UTC) when this event ended. Measured in milliseconds since the Unix epoch. |
| event.score | string | The confidence score for the intelligence signal within the range of 1 and 1000, with 1000 being the highest level of confidence. |