Description of icon
Flex UI
API Reference

ProfileConnectorHelper

Helper class for Profile Connector.


isSupportedTask(task) => boolean#

Check if a task is supported for profile connector - call, sms, whatsapp, or email are supported

Parameters:

  • task: ITask

    The active task in the Flex UI

Returns:

  • boolean

    true if the task is supported for profile connector

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
const boolAnswer = ProfileConnectorHelper.isSupportedTask(task);

isTaskValidForLinking(task) => boolean#

Check if a task has a valid Status for linking to a profile connector - assigned or wrapping are supported

Parameters:

  • task: ITask

    The active task in the Flex UI

Returns:

  • boolean

    true if the task has a valid Status for linking to a profile connector

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
const boolAnswer = ProfileConnectorHelper.isTaskValidForLinking(task);

fetchAndSetProfileConnectorForTask(task) => Promise<(IProfileConnector|undefined)>#

Fetch profile connector for a task from existing Context Service, store it in the context

Parameters:

  • task: ITask

    The active task to which the profile connector is associated

Returns:

  • Promise<(IProfileConnector|undefined)>

    The profile connector associated with the task.

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
const profileConnector = await ProfileConnectorHelper.fetchAndSetProfileConnectorForTask(task);

setProfileConnectorForTask(task, profileConnector) => unknown#

Set profile connector for a task in ProfileConnectorContext, and context

Parameters:

  • task: ITask

    The active task to which the profile connector is associated

  • profileConnector: IProfileConnector

    The profileConnector to set

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
ProfileConnectorHelper.setProfileConnectorForTask(task, profileConnector);

eraseProfileConnectSidForTask(task, profileConnector) => unknown#

Erase profileConnectSid for a task

Parameters:

  • task: ITask

    the task to erase profileConnectSid for

  • profileConnector: IProfileConnector

    the profileConnector to erase

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
ProfileConnectorHelper.eraseProfileConnectSidForTask(task, profileConnector);

createAndLinkContext(task, profileConnector) => Promise<(IProfileConnector|undefined)>#

Create and Link Context - entry point for the setup of a new Context in the case of an outbound call

Parameters:

  • task: ITask

    The task to create a new context for

  • profileConnector: IProfileConnector

    The profile connector to link the new context to

Returns:

  • Promise<(IProfileConnector|undefined)>

    The profile connector with the new contextSid

Example:

import { ProfileConnectorHelper } from "@twilio/flex-ui";
ProfileConnectorHelper.createAndLinkContext(task, profileConnector);

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.