How it works:
The code for this sample is available on GitHub to view.
You will need an Account SID and Auth Token in order to run this code.
Checking for existing account...
Follow the setup instructions in the README to get the sample up and running.
The Node.js runtime is required to run the Twilio CLI and the sample code.
The Twilio CLI is a command line tool that allows you to interact with Twilio APIs and services, and is necessary to deploy this template.
The suggested way to install the Twilio CLI on macOS is to use Homebrew. If you don't already have it installed, visit the Homebrew site for installation instructions and then return here.
Once you have installed Homebrew, run the following command to install the Twilio CLI:
brew tap twilio/brew && brew install twilio
Beyond the base commands, Twilio CLI's functionality can be extended through plugins. In this case, the Serverless Toolkit plugin is needed to deploy the serverless functions that will power this template.
twilio plugins:install @twilio-labs/plugin-serverless
In order for the CLI to access your Twilio account and execute commands on your behalf, you need to log in and provide your Twilio credentials. This can be done by running:
twilio login
You will be prompted for your Account SID and Auth Token, both of which you can find on the dashboard of your Twilio console.
To create a new project with the name example
and the current template, run the following command:
twilio serverless:init example --template=hello-voice
This will create a new directory called example
(or whatever name you picked) and will download all necessary files and dependencies for you.
Depending on the template, there might be additional setup instructions necessary to make the project work.
Check the instructions for this template to see if there are any additional steps to complete.
You can now deploy your code by running the following command:
cd example
twilio serverless:deploy