Description of icon
Flex UI
API Reference

Manager

The Flex Manager is the access point for controlling your Flex instance and all of the underlying Twilio products used for communications and assigning tasks. This means that within your Flex project, you can access the TaskRouter or Chat client directly through the Flex manager. Aside from Flex itself, Manager also gives you access to the Conversations, Sync, Voice, and TaskRouter SDKs.


getInstance() => Manager#

Gets the instance of Manager

Returns:

  • Manager

    instance

Example:

import { Manager } from "@twilio/flex-ui";
Manager.getInstance()

create(config, store?) => Promise.<Manager>#

Creates an instance of Flex Manager

Parameters:

  • config: Config

    Configuration

  • store?: Store.<FlexState>

    Custom Redux store

    • flex: AppState - Flex application state

Returns:

Example:

import * as React from "react";
import * as ReactDOM from "react-dom";
import { Manager, ContextProvider, RootContainer } from "@twilio/flex-ui";
Manager.create(configuration)
.then((manager) => {
ReactDOM.render(
<ContextProvider manager={manager}>
<RootContainer />
</ContextProvider>,
document.getElementById("container")
);
})
.catch((e) => {
console.log("Failed to run Flex", e);
});

updateConfig(configs) => void#

Updates current configuration by merging provided configuration objects deeply with the current configuration.

Parameters:

  • configs: Config

    configuration objects to merge in

Returns:

  • void

Example:

import { Manager } from "@twilio/flex-ui";
Manager.getInstance().updateConfig({
logLevel: "debug"
});

fetchConfiguration() => Promise.<Config>#

Fetches Flex configuration from the service.

Returns:

Example:

import { Manager } from "@twilio/flex-ui";
const config = await Manager.getInstance().fetchConfiguration();

configuration: Config#

Current configuration

Example:

import { Manager } from "@twilio/flex-ui";
Manager.getInstance().configuration;

serviceConfiguration: ServiceConfiguration#

Service configuration

Example:

import { Manager } from "@twilio/flex-ui";
const accountSid = Manager.getInstance().serviceConfiguration.account_sid;

store: EnhancedStore.<FlexState>#

Instance of Flex Redux store

Example:

import { Manager } from "@twilio/flex-ui";
Manager.getInstance().store

events: FlexEventEmitter#

Flex event emitter. User to subscribe to Flex events.

Example:

import { Manager } from "@twilio/flex-ui";
Manager.events.removeAllListeners();

strings: Strings#

Get or set strings / templates for Flex. Add or updates existing ones.

user: UserInfo#

Current user information

conversationsClient#

Instance of Twilio Conversation Client.

voiceClient: twilio-client:Device#

Returns an instance of Twilio.Device which is used to handle calls.

workerClient: twilio-taskrouter:Worker#

Returns an instance of Twilio TaskRouter Worker Client.

insightsClient: twilio-sync:Client#

Returns an instance of Twilio Sync Client.

Need some help?