Introducing the Nexmo Command Line Interface (CLI)

Published June 29, 2016 by Phil Leggetter

We’ve been testing and using the Nexmo Command Line Interface (CLI) for just over a month. We’re pretty happy with it so we thought we’d share it with you and find out what you think. Of course, it’s open source so please do fork nexmo-cli, raise issues if you have any questions and submit a PR with any suggested improvements.

If you’re from a telecoms background, where there are far too many acronyms to remember (unless you’re Sam Machin), it’s important not to get the CLI acronym for Command Line Interface confused with Calling Line Identity.

Why do I need a Command Line Interface (CLI)?

CLIs are great for both convenience and as a power tool. The Nexmo CLI is no different.

If you tend to work in the terminal or console then you can now perform a number of tasks without switching context. You can also set up your editor or IDE (Integrated Development Environment) to access the terminal and thus also execute nexmo commands there. Again, no context switching.

Nexmo Command Line Interface (CLI) in Atom Editor
Using the Nexmo CLI in Atom Editor via the terminal-plus package

For power users, you can automate processes, integrate into your continuous integration builds or pipe results from one command into another. For example, searching for numbers using nexmo number:search COUNTRY_CODE and buying numbers using nexmo number:buy NUMBER can be combined to quickly buy the first available UK number:

A final consideration is that since we’re generally an API-first company, some of our functionality makes it’s way into the Nexmo CLI early in order to improve developer workflow for those involved in our Early Adopter (EA) programmes (get in touch if that sounds interesting). That’s the case for the upcoming version 2 of our Voice API (more coming on this shortly).

How do I get the Nexmo CLI?

You install the Nexmo CLI using:

This, of course, means you have to have Node.JS installed on your machine. We believe that most developers are likely to have this installed anyway. But it’s also meant that the Nexmo CLI works on Mac, Windows and Linux.

What can I do with the Nexmo CLI?

Lots of things! In general, run nexmo --help for all the information you require or nexmo COMMAND --help for information on a specific command. For each command there is will also be as short command that can save you a few keystrokes. That said, here are a few specific examples to help.

Search numbers:

Note: remember to use fictional phone numbers in examples.

Buy numbers:

List numbers:

Configure numbers:

Perform number insight:

Check account balance:

Note to self: give yourself more credit.

… and much more. We recommend keeping an eye on the nexmo-cli GitHub project for updates.

We’d love your feedback

We’ve found the Nexmo CLI very useful throughout the company. For some, it’s simply more efficient to run a command from a terminal than it is navigate a web dashboard. For others, it greatly improves their developer workflow. Is it useful to you?

Finally, yet another thanks to Cristiano Betta who worked closely with the Nexmo DevRel team on the project, and continues to be involved.


Leave a Reply

Your email address will not be published.

Get the latest posts from Nexmo’s next-generation communications blog delivered to your inbox.

By signing up to our communications blog, you accept our privacy policy , which sets out how we use your data and the rights you have in respect of your data. You can opt out of receiving our updates by clicking the unsubscribe link in the email or by emailing us at [email protected].