Rejects a task for the current worker.
The unique identifier (SID) of the task to be rejected.
Optional parameters for rejecting the task, such as the activity SID to set after rejection.
A promise that resolves to a Reservation and a Task object representing the rejected task.
Reservation
Task
FlexSdkError with the following error code(s):
import { createClient } from "@twilio/flex-sdk";import { RejectTask } from "@twilio/flex-sdk/actions/Task";async function rejectTask() { const client = await createClient("SDK_TOKEN"); const rejectTask = new RejectTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const { task, reservation } = await client.execute(rejectTask); return { task, reservation };} Copy
import { createClient } from "@twilio/flex-sdk";import { RejectTask } from "@twilio/flex-sdk/actions/Task";async function rejectTask() { const client = await createClient("SDK_TOKEN"); const rejectTask = new RejectTask("WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); const { task, reservation } = await client.execute(rejectTask); return { task, reservation };}
Optional
Rejects a task for the current worker.
Param: taskSid
The unique identifier (SID) of the task to be rejected.
Param: options
Optional parameters for rejecting the task, such as the activity SID to set after rejection.
Returns
A promise that resolves to a
Reservationand aTaskobject representing the rejected task.Throws
FlexSdkError with the following error code(s):
Example