Completes a task that is either pending or assigned.
The unique identifier (SID) of the task to be completed.
A promise that resolves to a Task object, representing the completed task.
Task
FlexSdkError with the following error code(s):
import { createClient } from "@twilio/flex-sdk";import { CompleteTask } from "@twilio/flex-sdk/actions/Task";async function completeTask() { const client = await createClient("SDK_TOKEN"); const completeTask = new CompleteTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const completedTask = await client.execute(completeTask); return completedTask;} Copy
import { createClient } from "@twilio/flex-sdk";import { CompleteTask } from "@twilio/flex-sdk/actions/Task";async function completeTask() { const client = await createClient("SDK_TOKEN"); const completeTask = new CompleteTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const completedTask = await client.execute(completeTask); return completedTask;}
Completes a task that is either pending or assigned.
Param: taskSid
The unique identifier (SID) of the task to be completed.
Returns
A promise that resolves to a
Taskobject, representing the completed task.Throws
FlexSdkError with the following error code(s):
Example