Skip to main content

Run the template locally

If you wish to modify the template in any way, you will need to set up your development environment to run the template locally using the following steps.

Prerequisites

  • you are running node v18 or above
  • twilio cli 5.20.0 or above is installed (twilio --version)
  • twilio flex plugins 7.0.0 or above is installed (twilio plugins, twilio plugins:install @twilio-labs/plugin-flex@latest)
  • twilio serverless plugin 3.1.6 or above is installed (twilio plugins twilio plugins:install @twilio-labs/plugin-serverless@latest)
  • twilio profiles:list has an active account set.
  • have the twilio auth token for your account ready (you can find this in the Twilio Console)
  • If you are running Windows, ensure you are using Git Bash to execute the commands when working with the template, rather than Command Prompt or PowerShell.
Feature Functionality

some features may not be functional without a deployment of the TaskRouter configuration and studio flows. It is recommended to do at least one initial deploy to your environment using the Deploy Flex GitHub workflow

Setup

  1. Follow the steps to do an initial deploy to hosted Flex at least once
  2. Clone the new repository that you just created
git clone <repo-url>
  1. Make sure the Twilio CLI has the correct account set to active, if not create one
twilio profiles:list
  1. cd into the repository and execute the following (this installs all sub-project package dependencies and generates .env configuration for you)
npm install
  1. follow the prompt and provide your auth token

  2. Run the serverless functions, Insights proxy, and plugin together locally by running the following at the top level of the checkout

npm start
Feature Limitation

the admin panel is disabled by default when working locally. See the admin panel docs for more information

Development Gotcha

When developing locally, Flex config is overridden by anything in your plugin-flex-ts-template-v2/public/appConfig.js. appConfig is only applicable when running the plugin locally, so you can edit this file to toggle features on and off for your locally running web server. You can also tweak the api endpoint for your serverless functions if you need to.