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: ITaskThe active task in the Flex UI
Returns:
booleantrue 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: ITaskThe active task in the Flex UI
Returns:
booleantrue 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: ITaskThe 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: ITaskThe active task to which the profile connector is associated
profileConnector: IProfileConnectorThe 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: ITaskthe task to erase profileConnectSid for
profileConnector: IProfileConnectorthe 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: ITaskThe task to create a new context for
profileConnector: IProfileConnectorThe 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);