Newer Version Available
Service Cloud Voice Toolkit API Conversation Events
Listen to events related to a conversation.
The following conversation events are available.
| Event Name | Description |
|---|---|
| TRANSCRIPT | Sent when a new utterance is received by the transcription system. |
To subscribe to this event, add a conversation event listener.
1// Subscribe
2cmp.find('voiceToolkitApi')
3 .addConversationEventListener('TRANSCRIPT', conversationEventListenerFunc);
4
5// Unsubscribe
6cmp.find('voiceToolkitApi')
7 .removeConversationEventListener('TRANSCRIPT', 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 "clientSentTimestamp": 1594944652299,
5 "serverReceivedTimestamp": 1594944652328,
6 "content":{
7 "formatType": "Text",
8 "text": "Hello"
9 },
10 "callId": "c5d93c19-e03b-44f8-85e6-a11f02e70c45",
11 "sender": {
12 "role": "Agent"
13 }
14 }
15}The following table describes all the payload properties.
| Property Name (type) | Description |
|---|---|
| type (string) | Type of conversation event. |
| detail (object) | Details associated with this event. |
| detail.clientSentTimestamp (number) | Timestamp for when the client sent this content. |
| detail.serverReceivedTimestamp (number) | Timestamp for when the server received this content. |
| content (object) | Information about the content. |
| content.formatType (string) | Content format type. For example, “Text”. |
| Content.text (string) | Content text. |
| callId (string) | Unique call identifier value. |
| sender (object) | Information about the sender. |
| sender.role (string) | Role of the sender. For example, “Agent”. |