Before you begin

What are building blocks?

Building blocks are short pieces of code you can reuse in your own applications. The building blocks utilise code from the Nexmo Node Quickstart  and Curl Building Block  repositories.

Please read this information carefully, so you can best use the building blocks.

Prerequisites

  1. Create a Nexmo account
  2. Rent a Nexmo Number
  3. Install the Nexmo Command Line tools
  4. Create a Nexmo Application in the Dashboard 
  5. Install the Nexmo Node Client Library - if writing applications using Node.
  6. Set up Ngrok  - if testing locally.

Other resources:

Replaceable variables

Generic replaceable

The following replaceable information depends on the library and specific call:

Key Description
NEXMO_API_KEY API key.
NEXMO_API_SECRET API secret.
NEXMO_APPLICATION_PRIVATE_KEY_PATH Private key path.
NEXMO_APPLICATION_PRIVATE_KEY Private key.
NEXMO_APPLICATION_ID The Nexmo Application ID.

Numbers

All phone numbers are in E.164 format.

Key Description
NEXMO_NUMBER Replace with your Nexmo Number. E.g. 447700900000
FROM_NUMBER Replace with number you are sending from. E.g. 447700900002
TO_NUMBER Replace with the number you are sending to. E.g. 447700900001

Specific replaceable/variables

Some building blocks have more specialised variables, such as Facebook Page IDs, that will need to be replaced by actual values. Where required, these are specified on a per-building block basis.

Webhooks

The main ones you will meet here are:

If you are testing locally using Ngrok  you will set your webhook URLs in the Nexmo Application object using a format similar to the following examples:

Change demo in the above with whatever Ngrok generates for you, unless you have paid for a reusable URL.