Service Cloud Voice Toolkit API

lightning-service-cloud-voice-toolkit-api

A collection of front-end event listeners and API methods for interacting with Service Cloud Voice using the lightning-service-cloud-voice-toolkit-api component. This component requires API version 52.0 and later.

For Use In

Lightning Experience

Service Cloud Voice Toolkit API is a collection of front-end event listeners and API methods for interacting with the Service Cloud Voice product. This toolkit takes advantage of Einstein Next Best Action to give agents what they need when they need it during a conversation.

To use the Service Cloud Voice Toolkit API in your component:

  • Add the lightning-service-cloud-voice-toolkit-api component to your component’s HTML template file.
1<!-- yourComponent.html -->
2
3<template>
4    <lightning-service-cloud-voice-toolkit-api>
5    </lightning-service-cloud-voice-toolkit-api>
6    ...
7</template>
  • Include the lightning__ServiceCloudVoiceToolkitApi capability in your component’s configuration file, <component>.js-meta.xml.
1// yourComponent.js-meta.xml
2
3<?xml version="1.0" encoding="UTF-8"?>
4<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
5  <apiVersion>52.0</apiVersion>
6  <isExposed>true</isExposed>
7  <capabilities>
8    <capability>lightning__ServiceCloudVoiceToolkitApi</capability>
9  </capabilities>
10</LightningComponentBundle>

For more information about configuration files, see XML Configuration File Elements.

Service Cloud Voice Events 

Make your components context-aware by listening to events that take place during phone calls.

To subscribe to an event, add an event listener. For instance, the following code subscribes and unsubscribes to the callstarted event type.

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, your listener function receives 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}

For information about the available events, see Service Cloud Voice LWC Toolkit API Events.

Next Best Action 

The toolkit provides the updateNextBestActions method, which enables your component to give recommendations in real time with Next Best Action.

For more information, see Service Cloud Voice LWC Toolkit Next Best Action.

See Also 

Methods 

NameDescriptionArgument NameArgument TypeArgument Description
acceptCallAccept the call
addParticipantWhen a participant is added to the call and with/without being a blind transfer.
declineCallDecline the call
endCallEnd the call
holdPuts the call on hold
mergeWhen participants on a three-way call are all taken off hold.
muteMute the call
pauseRecordingPause the recording of the current call
resumeResumes the call if on hold
resumeRecordingResume the recording of the current call
sendDigitsCalled when an agent sends digits on the existing call
startPreviewCallStart the preview call.
swapWhen participants on a three-way call have their hold status swapped.
unmuteUnmute the call
updateNextBestActionsInvoke real-time Next Best Action recommendations.recordIdStringID of the record for which Recommendations should be shown.
parametersObjectKey-value pairs passed to RecommendationStrategy.