@twilio/flex-sdk
    Preparing search index...

    Class SetCurrentActivity

    Sets the current activity for the worker.

    The unique identifier (SID) of the activity to be set as the current activity.

    Optional configuration parameters for customizing the activity setting process.

    A promise that resolves when the current activity is successfully set.

    import { createClient, SetCurrentActivity } from "@twilio/flex-sdk";

    async function setCurrentActivity() {
    const client = await createClient("SDK_TOKEN");
    const worker = await client.getWorker();

    // Activities are accessible via Worker.activities property (Map of activitySID to Activity)
    const activities = Array.from(worker.activities.values());
    const targetActivity = activities.find(activity => activity.name === "Available") || activities[0];

    console.log(`Setting worker activity to "${targetActivity.name}" (${targetActivity.sid})`);

    const setCurrentActivityAction = new SetCurrentActivity(targetActivity.sid);
    await client.execute(setCurrentActivityAction);
    }

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parameters

      • ctx: {}

      Returns Promise<void>