Adds a task participant event listener.
The unique identifier (SID) of the task.
The event name (e.g. participantAdded).
The event listener function.
A promise that resolves to an object containing the unsubscribe function to remove the listener.
FlexSdkError with the following error code(s):
import { createClient } from "@twilio/flex-sdk";import { AddTaskParticipantListener } from "@twilio/flex-sdk/actions/Task";async function addTaskParticipantListener() { const client = await createClient("SDK_TOKEN"); const addTaskParticipantListener = new AddTaskParticipantListener( "WTxxx", "participantAdded", (task, participant) => { console.log(`Participant added: ${participant.sid} to task ${task.sid}`); } ); const { unsubscribe } = await client.execute(addTaskParticipantListener); return unsubscribe;} Copy
import { createClient } from "@twilio/flex-sdk";import { AddTaskParticipantListener } from "@twilio/flex-sdk/actions/Task";async function addTaskParticipantListener() { const client = await createClient("SDK_TOKEN"); const addTaskParticipantListener = new AddTaskParticipantListener( "WTxxx", "participantAdded", (task, participant) => { console.log(`Participant added: ${participant.sid} to task ${task.sid}`); } ); const { unsubscribe } = await client.execute(addTaskParticipantListener); return unsubscribe;}
Adds a task participant event listener.
Param: taskSid
The unique identifier (SID) of the task.
Param: eventName
The event name (e.g. participantAdded).
Param: listener
The event listener function.
Returns
A promise that resolves to an object containing the unsubscribe function to remove the listener.
Throws
FlexSdkError with the following error code(s):
Example