Newer Version Available

This content describes an older version of this product. View Latest

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        "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) Type of conversation event.
detail (object) Details associated with this event.
detail.id (string) Unique identifier for the message.
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”.