Twilio CLI is Now Generally Available

October 19, 2022
Written by
Twilion
Reviewed by
Contributor
Opinions expressed by Twilio contributors are their own
Twilion

CLI GA Header

We are excited to announce that Twilio Command-line Interface (CLI) is now generally available. Start using Twilio CLI to simplify and optimize your development workflow! The Twilio CLI enables you to build, test, deploy and maintain directly from your terminal, reducing the context switching needed between your IDE, browser tabs, console, and terminal. Additionally, the CLI can be used to automate repetitive tasks, add logs, use commands to simplify interactions with APIs by grouping common tasks together, and much more.

Here’s an overview of some key features of Twilio CLI to get you started.

Commands

All Twilio APIs can be accessed from the terminal with api as a root command.

Explore and call any API directly from your terminal using: 

 

$ twilio api:<command>

We have bundled up the most common functionalities together into CLI commands to ensure that the Twilio CLI goes beyond being a wrapper around APIs, and enables you to quickly complete your tasks.

For example, to view a list of available phone numbers in your country and area code, use:

twilio api:core:available-phone-numbers:local:list \
  --area-code="209" --country-code US

Buy a phone number from your terminal using:

twilio api:core:incoming-phone-numbers:create \
  --phone-number="+1334679906"

Debug your applications using:

twilio debugger:logs:list

Try out more examples here.

 

Explore CLI with autocomplete and help 

We recommend you enable autocompletion by using the twilio autocomplete command. Once autocomplete is enabled, you can press the Tab key to either automatically complete your command or display suggestions.

 

twilio autocomplete

Using autocomplete is not just great for reducing the time taken to write commands, it's also great for exploring CLI commands.

After tabbing around and discovering commands relevant to you, use the --help or -h flag to find more information about arguments and supported flags for these commands.

The above example showcases exploring the Conversations API using Tab and --help, CLI commands associated with all the topics can be explored similarly.

Extend CLI functionality using Plugins

Twilio CLI has a built-in plugin framework which can be used to extend the Twilio CLI, and allow your team to complete common operational tasks. You can publish your plugins to share with the community, or make them private for your own or your client's usage. Learn more about how to build your own plugin here.

Install a plugin by using the plugins:install command and its package name:

twilio plugins:install <plugin-package-name>

Want to try CLI plugins before building your own?

You can also start extending the CLI functionality with existing plugins built by Twilions. Some of our favorite plugins are:

  • Twilio Flex: Use the Twilio Flex plugin to develop, build and deploy Flex plugins to customize your contact center.
twilio plugins:install @twilio-labs/plugin-flex
  • Install the Serverless plugin to locally develop, debug, and deploy to Twilio Serverless via the terminal.
   twilio plugins:install @twilio-labs/plugin-serverless
  • Use the Dev phone plugin to test your Twilio apps when you don’t have reliable, easy access to SMS and calling capabilities.

           

 twilio plugins:install @twilio-labs/plugin-dev-phone

 

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

Click here to learn more about CLI plugins.

Plugins are built on top of the Twilio CLI; please check the repository of the plugin that you are interested in, and confirm whether it is in beta or generally available.

Control the command output

Customize the command output format, filter the output columns, or limit the values according to your use case.

  • Use the --properties option to explicitly control which columns to output.
  • Want to pipe CLI output to tools like jq to parse JSON (JavaScript Object Notation)? Add -o json to any command and send the entire API response to stdout as JSON.
  • Need to modify your output for machine processing tasks? Add -o tsv to the command to change the output format to Tab Separated Values (TSV).

Ready to get started with CLI?

Use our quick start guide to become familiar with the Twilio CLI and start building with us.

In case of issues in the GA version, you can raise a ticket to support. If you have feedback or feature requests, please run the twilio feedback command directly from your CLI and share your feedback.

We're excited to see what you build!