JavaScript

Configure your prerequisites

There are a few prerequisites that you need to complete before you can work through this tutorial. If you've already completed any of them, feel free to skip that step.


You can create a Nexmo account via the Nexmo Dashboard.

Within the Dashboard you can create applications and purchase Nexmo numbers. You can also perform these tasks using the Nexmo CLI.

If you want to carry out tasks such as creating applications, purchasing Nexmo numbers and so on, you will need to install the Nexmo CLI. As the Nexmo CLI requires node.js you will need to install node.js first.

If you are planning to use JavaScript to develop your application, you'll need to install (or update) the latest version of the Client SDK for JavaScript.

Create a new project directory and change into it.

To create a blank project, run this command:

npm init -y

The following command will install the Client SDK into the node_modules directory within your project folder:

npm install nexmo-client --save

If you already have the Client SDK installed the above command will upgrade your Client SDK to the latest version.

The Nexmo CLI allows you to carry out many operations on the command line. Examples include creating applications, purchasing numbers, and linking a number to an application.

To install the Beta version of the CLI with NPM you can use:

npm install nexmo-cli@beta -g

Set up the Nexmo CLI to use your Nexmo API Key and API Secret. You can get these from the settings page in the Nexmo Dashboard.

Run the following command in a terminal, while replacing api_key and api_secret with your own:

nexmo setup api_key api_secret

A public and accessible by the internet webpage is required for this tutorial to be completed. To accomplish that, we will be using GitHub Gist, so a GitHub Account is mandatory.

If you just signed up, please ensure that you verified your email address and are logged in.