Twilio integration basics

Surface real-time suggestions by integrating UI modules with Twilio.

Before you begin

To integrate UI modules with Twilio Flex, you need access to the following resources:

When you have access, take the following steps to get started:

  1. Deploy the backend module. When you deploy the backend server, specify the environment variable AUTH_OPTION to be Twilio following the deployment instruction.
  2. Clone the git repository onto your local machine or development environment with the following code:
    git clone https://github.com/GoogleCloudPlatform/agent-assist-integrations
    

Step 1: Install the Twilio CLI

To install the Twilio CLI,

  1. Install Node 18.
  2. Install the Twilio CLI.

Step 2: Install plugins

The Twilio CLI provides two plugins: Flex and serverless. To install the plugins, you need access to the following:

  • NPM version 6.0.0 or later (type npm -v in your terminal to check)
  • Node versions 14, 16 or 18 (type node -v in your terminal to check)

Flex

Install the Flex plugin using the following Twilio plugin command:

twilio plugins:install @twilio-labs/plugin-flex

Serverless

Install the serverless plugin using the Twilio plugin command:

twilio plugins:install @twilio-labs/plugin-serverless

Step 3: Create a profile for Twilio CLI

To issue CLI commands that include your Twilio credentials, first create a profile using the following command:

twilio login

Twilio will prompt you for your account SID and auth token, both of which you can find on the dashboard of your Twilio console. When prompted for the shorthand identifier, use the name dev.

Example profile creation:

$ twilio login
You can find your account SID and auth token at https://www.twilio.com/console
 » Your auth token will be used once to create an API key for future CLI access to your Twilio account or subaccount, then forgotten.
? The account SID for your Twilio account or subaccount: ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
? Your Twilio auth token for your Twilio account or subaccount: [hidden]
? Shorthand identifier for your profile: dev

When you run twilio login (an alias for twilio profiles:create), it uses your account SID and auth token to generate an API key, stores the key in a configuration file, and associates the key with the profile to authenticate future requests. For security, your auth token is only used to generate the API key and is not stored locally after the profile is created.

Set an active profile

To activate a profile, run the following code:

twilio profiles:use PROFILE_ID

Use the shorthand identifier dev for the PROFILE_ID.

What's next