Ends a task.
The unique identifier (SID) of the task to be ended.
A promise that resolves to a Reservation and a Task object, representing the ended task.
Reservation
Task
FlexSdkError with the following error code(s):
import { createClient } from "@twilio/flex-sdk";import { EndTask } from "@twilio/flex-sdk/actions/Task";async function endTask() { const client = await createClient("SDK_TOKEN"); const endTask = new EndTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const { task, reservation } = await client.execute(endTask); return { task, reservation };} Copy
import { createClient } from "@twilio/flex-sdk";import { EndTask } from "@twilio/flex-sdk/actions/Task";async function endTask() { const client = await createClient("SDK_TOKEN"); const endTask = new EndTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const { task, reservation } = await client.execute(endTask); return { task, reservation };}
Ends a task.
Param: taskSid
The unique identifier (SID) of the task to be ended.
Returns
A promise that resolves to a
Reservationand aTaskobject, representing the ended task.Throws
FlexSdkError with the following error code(s):
Example