Salesforce Voice LWC Toolkit API Telephony Events
The following events are available.
| Event Name | Description |
|---|---|
| audiostats | Sent during a call, publishing real-time WebRTC audio statistics every 30
seconds. This event isn't supported in Salesforce Voice (Native Telephony). |
| callstarted | Sent when the call starts. This event isn't supported in Salesforce Voice (Native Telephony). |
| callconnected | Sent when the call connects. |
| callended | Sent when the call ends. |
| hold | Sent when the call is put on hold. |
| resume | Sent when the call resumes after hold. |
| mute | Sent when the call is muted. |
| unmute | Sent when the call is unmuted. |
| participantadded | Sent when a participant is added to the call. |
| participantremoved | Sent when a participant is removed from the call. |
| conference | Sent when participants on a three-way call are all taken off hold. |
| swap | Sent when participants on a three-way call have their hold status swapped. This event isn't supported in Salesforce Voice (Native Telephony). |
| pauserecording | Sent when the rep pauses call recording. |
| resumerecording | Sent when the rep resumes call recording. |
| transcript | Sent when a new utterance is received by the transcription system. |
| wrapupended | Sent when the rep exits after call work status. This event isn't supported in Salesforce Voice (Native Telephony). |
| flagraise | Sent when a rep, while communicating with a customer, quietly raises a flag to get help from a supervisor. |
| flaglower | 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. |
To subscribe to these events, add an event listener for each event you want to listen to.
1// Subscribe
2const toolkitApi = this.template.querySelector('lightning-service-cloud-voice-toolkit-api');
3toolkitApi.addEventListener('callstarted', <listener>);
4
5// Unsubscribe
6const toolkitApi = this.template.querySelector('lightning-service-cloud-voice-toolkit-api');
7toolkitApi.removeEventListener('callstarted', <listener>);When an event occurs, you receive a JSON payload that contains the event type, along with any relevant data. For instance, the callstarted event contains the following payload.
1{
2 "type": "callstarted",
3 "detail": {
4 "callId": "d7a9f1b7-fc17-43fe-8ca7-e584a2b34792",
5 "callType": "outbound",
6 "participant": "+1 (415) 999-0000"
7 }
8}All payloads contain some basic information, such as the event type (type) and a unique call identifier (callId). Events can contain additional values within the detail object. Refer to the following table for all the possible properties that can appear within the detail object of the payload.
| Event Name | Payload “detail” Properties |
|---|---|
| audiostats |
This event isn't supported in Salesforce Voice (Native Telephony). |
| callstarted |
This event isn't supported in Salesforce Voice (Native Telephony). |
| callconnected |
|
| callended |
|
| hold |
|
| resume |
|
| mute |
|
| unmute |
|
| participantadded |
|
| participantremoved |
|
| conference |
|
| swap |
This event isn't supported in Salesforce Voice (Native Telephony). |
| pauserecording |
|
| resumerecording |
|
| wrapupended |
This event isn't supported in Salesforce Voice (Native Telephony). |
| transcript |
For example, see transcript. |
| flagraise |
For example, see flagraise. |
| flaglower |
For example, see flaglower. |
| note |
For example, see note. |
Payloads may contain other system-generated information.
transcript
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}flagraise
1{
2 "type": "flagraise",
3 "detail": {
4 "id": "3115b389-ab50-400e-b8ba-978b7ec51d7a"
5 "clientSentTimestamp": 1594944652299,
6 "serverReceivedTimestamp": 1594944652328,
7 "content":{
8 "formatType": "Text",
9 "text": "The customer wants a credit note."
10 },
11 "callId": "c5d93c19-e03b-44f8-85e6-a11f02e70c45",
12 "sender": {
13 "role": "Agent",
14 "displayName": "Angela Agent"
15 },
16 "voiceCallId": "0LQRM0000006CSz"
17 }flaglower
1{
2 "type": "flaglower",
3 "detail": {
4 "id": "3115b389-ab50-400e-b8ba-978b7ec51d7a"
5 "clientSentTimestamp": 1594944652299,
6 "serverReceivedTimestamp": 1594944652328,
7 "content":{
8 "formatType": NULL,
9 "text": NULL
10 },
11 "callId": "c5d93c19-e03b-44f8-85e6-a11f02e70c45",
12 "sender": {
13 "role": "Supervisor",
14 "displayName": "Samir Supervisor"
15 },
16 "voiceCallId": "0LQRM0000006CSz"
17 }note
1{
2 "type": "note",
3 "detail": {
4 "id": "3115b389-ab50-400e-b8ba-978b7ec51d7a"
5 "clientSentTimestamp": 1594944652299,
6 "serverReceivedTimestamp": 1594944652328,
7 "content":{
8 "formatType": "Text",
9 "text": "The customer wants a refund or store credit."
10 },
11 "callId": "c5d93c19-e03b-44f8-85e6-a11f02e70c45",
12 "sender": {
13 "role": "Agent",
14 "displayName": "Angela Agent"
15 }
16}