Receiving an SMS

Handling inbound SMS with Nexmo is easy. You just need to create a webhook endpoint and configure your number or account to point to the endpoint.


Implement a webhook endpoint

const app = require('express')()
const bodyParser = require('body-parser')

app.use(bodyParser.urlencoded({ extended: true }))


function handleInboundSms(request, response) {
  const params = Object.assign(request.query, request.body)


Run your server

Save this file to your machine and run it using the node command:

$ node app.js

You'll need to expose your server to the open internet. During development you can use a tool like Ngrok  to do that.

Configure your SMS endpoint with Nexmo

From Nexmo Dashboard  go to Settings  .

Enter your endpoint in the field labeled Webhook URL for Inbound Message:


Send your Nexmo number an SMS

Now when you send your Nexmo number an SMS you should see it logged in your console.