Deploy Twilio Flex

The frontend portion of the Twilio integration consists of two components: Twilio functions and plugins. Functions host the HTML document and API methods needed to use Agent Assist and replace the need for hosting elsewhere. A Twilio plugin is a way to present the Agent Assist interface to the agent desktop.

Twilio functions

The Twilio functions are serverless API endpoints that can perform work hosted by Twilio. They provide user verification, chat service tokens, and the Agent Assist interface.

Twilio Flex plugin

Use the Flex plugin to customize user experiences and behaviors for the Flex agents and supervisors. You present the Agent Assist console to the agent within the Flex application.

Environment variables

  1. Create a file named .env in the agent-assist-functions directory or
  2. Create a file named .env.dev in the agent-assist-plugins directory.
  3. Set the following environment variables for the plugin to function after deployment:
Name type Context
TWILIO_ACCOUNT_SID Find in the Twilio Flex dashboard.
ACCOUNT_SID Find in the Twilio Flex dashboard.
AUTH_TOKEN Find in the Twilio Flex dashboard.
TWILIO_API_KEY Create in the Twilio console.
TWILIO_API_SECRET Create in the Twilio console.
TWILIO_CHAT_SERVICE_SID Locate the service SID.
PROXY_SERVER_URL This is the backend server URL.
TWILIO_CONVERSATION_PROFILE Find in the Twilio Flex Dashboard.
TWILIO_FEATURES This is a comma-separated list of Agent Assist suggestion features to render, such as: `SMART_REPLY`, `CONVERSATION_SUMMARIZATION`
TWILIO_FUNCTIONS_URL This is the Cloud Run URL for the backend application after you deploy the functions. Select the Twilio Agent Assist Functions option. Then, you should see a URL resembling twilio-agent-assist-functions-####-dev.twil.io.
TWILIO_DEBUG Show logs in the console: True, false, or left undefined.

For more information regarding environment variable setup, refer to the relevant Twilio documentation.

Deployment

Use the following script to deploy the solution to your Twilio instance:

npm run deploy:functions #Deploys just the functions to the Twilio instance.
npm run deploy:plugin #Deploys just the plugin to the Twilio instance, run command produced in the output to activate.