Interface for managing task-related operations in the contact center Extends EventEmitter to support event-driven task updates

interface ITask {
    autoWrapup?: default;
    data: TaskData;
    webCallMap: Record<string, string>;
    accept(): Promise<TaskResponse>;
    cancelAutoWrapupTimer(): void;
    decline(): Promise<TaskResponse>;
    end(): Promise<TaskResponse>;
    fetchIvrTranscript(orgId, interactionId, timeoutMins): Promise<IvrConversations>;
    hold(): Promise<TaskResponse>;
    pauseRecording(): Promise<TaskResponse>;
    resume(): Promise<TaskResponse>;
    resumeRecording(resumeRecordingPayload): Promise<TaskResponse>;
    wrapup(wrapupPayload): Promise<TaskResponse>;
}

Hierarchy

  • EventEmitter
    • ITask

Implemented by

Properties

autoWrapup?: default

Auto-wrapup timer for the task This is used to automatically wrap up tasks after a specified duration as defined in AutoWrapup

data: TaskData

Event data received in the Contact Center events. Contains detailed task information including interaction details, media resources, and participant data as defined in TaskData

webCallMap: Record<string, string>

Map associating tasks with their corresponding call identifiers.

Methods

  • cancels the auto-wrapup timer for the task This method stops the auto-wrapup process if it is currently active Note: This is supported only in single session mode. Not supported in multi-session mode.

    Returns void

    void

  • Fetches the IVR transcript for the current voice task This method retrieves the Interactive Voice Response transcript that was recorded during the customer's interaction with the IVR system before being connected to an agent. Only available for voice tasks that have IVR interactions.

    Parameters

    • orgId: string

      Organization ID (required)

    • interactionId: string

      Interaction ID for the task (required)

    • timeoutMins: number

      Timeout in minutes for the transcript URL (required)

    Returns Promise<IvrConversations>

    Promise The IVR conversation turns array

    Throws

    Error if the task is not a voice task, no IVR transcript is available, or the fetch operation fails

    Example

    // Fetch IVR transcript after accepting a voice task
    try {
    const transcript = await task.fetchIvrTranscript(
    task.data.orgId,
    task.data.interactionId,
    10 // timeout in minutes
    );
    console.log('Conversation turns:', transcript.length);
    transcript.forEach((turn) => {
    if (turn.customer) {
    console.log(`${turn.customer.timestamp}: Customer — ${turn.customer.query}`);
    }
    if (turn.bot) {
    console.log(`${turn.bot.timestamp}: Bot (${turn.bot.botName}) — ${turn.bot.reply}`);
    }
    });
    } catch (error) {
    console.error('Failed to fetch IVR transcript:', error);
    // Handle case where no transcript is available
    }
  • Initiates wrap-up process for the task with specified details

    Parameters

    • wrapupPayload: WrapupPayLoad

      Wrap-up details including reason and auxiliary code

    Returns Promise<TaskResponse>

    Promise

    Example

    task.wrapup({
    wrapUpReason: "Customer issue resolved",
    auxCodeId: "RESOLVED"
    });