Sinch Developer Documentation

Building blocks to enable rich customer communication

Getting started - node

Learn how to quickly send SMS messages with the Sinch API

In this guide, we show you how to:

  1. Create an account and get your free test number (US only).
  2. Send your first SMS.

Sign up for a Sinch account

Before you can send your first SMS, you need a Sinch
. If you are in the United States, you also need a free test phone number.

Send SMS

//Create a new node app and copy this into app.js
var request = require("request");
var options = {
  method: 'POST',
  url: '{service_plan_id}/batches',
  headers: {accept: 'application/json', 'content-type': 'application/json',
      "Authorization": "Bearer {your token}"},
  body: '{"to":"[{To Number}]","from":"{your free test number}","body":"This is a test message"}'

request(options, function (error, response, body) {
  if (error) throw new Error(error);

Before you can execute the code that sends an SMS message, you need to modify it in a few places.

Replace the token values

Before you can execute the code that sends an SMS message, you need to replace the following values with your values:

{your token}
{your free test number}
{To number}

To find the service plan and token, go to, log in and click “Show” to reveal your API token.

Screen shot of dashboardScreen shot of dashboard

To find the From-number, click the service plan id link and scroll to the bottom of the page and then change the {To number} to your phone number.

Click here to read more about the batches endpoint.

Receive SMS via web-hook

The next step shows how to handle the sending of an SMS to your Sinch number.

Configure the Callback URL for your SMS service

Before you implement the server to handle incoming SMS, you need to configure your SMS service to handle callbacks. Head over to, click your service and you will see a section like the below.

Screen shot of dashboardScreen shot of dashboard

If you just want to look at what we post you can use

Click create and you will see:

Screen shot of request binScreen shot of request bin

Copy the bin URL to the callback URL info and click Save.

Screen shot of callback configuredScreen shot of callback configured

That's it! You're now ready to send an SMS to your Sinch number

To see the data we send on incoming SMS, refresh your request bin page.

requestbin requestrequestbin request

How to handle incoming SMS with Node.js

Create a new node app and paste this into app.js

const url = require("url");
const http = require("http");
const server = http.createServer((req, res) => {
  let data = [];
  req.on("data", (chunk) => {
  req.on("end", () => {

Before you can handle incoming traffic to your local server, you need to open up a tunnel to your local server. For that, you can use ngrok tunnel. Open a terminal/command prompt and type: ngrok http 3000

Copy the https address in your window, then run app.js in the command prompt 'node app.js'

requestbin requestrequestbin request

Go back to your dashboard and change the callback URL for your SMS service.

  1. In the terminal windows, start the app.js node app.js
  2. Send an SMS to your Sinch Number.
  3. You will now see the request come in.

requestbin requestrequestbin request

You can read more about all the different endpoints in the API reference guide

Edit on GitHub

Updated 5 days ago

Getting started - node

Learn how to quickly send SMS messages with the Sinch API

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.