Make an outbound call with an NCCO

This building block makes an outbound call and plays a text-to-speech message when the call is answered. You don't need to run a server hosting an answer_url to run this building block, as you provide your NCCO as part of the request


Replace the following variables in the example code:

Key Description
NEXMO_NUMBER Your Nexmo number that the call will be made from. For example 447700900000.
TO_NUMBER The number you would like to call to in E.164 format. For example 447700900001.


Create an application

A Nexmo application contains the required configuration for your project. You can create an application using the Nexmo CLI (see below) or via the dashboard. To learn more about applications see our Nexmo concepts guide.

Install the CLI

npm install -g nexmo-cli

Create an application

Once you have the CLI installed you can use it to create a Nexmo application. Run the following command and make a note of the application ID that it returns. This is the value to use in NEXMO_APPLICATION_ID in the example below. It will also create private.key in the current directory which you will need in the Initialize your dependencies step

nexmo app:create "Outbound Call with NCCO Building Block" --keyfile private.key

Write the code

Add the following to

Copy to Clipboard
curl -X POST\
  -H "Authorization: Bearer "$JWT\
  -H "Content-Type: application/json"\
  -d '{"to":[{"type": "phone","number": "'$TO_NUMBER'"}],
      "from": {"type": "phone","number": "'$NEXMO_NUMBER'"},
      "ncco": [
          "action": "talk",
          "text": "This is a text to speech call from Nexmo"

View full source

Run your code

Save this file to your machine and run it:


Try it out

When you run the code the TO_NUMBER will be called and a text-to-speech message will be heard if the call is answered.