Prerequisites

Create an application

Write the code

Add the following to app.js:

Copy to Clipboard

constNexmo=require('nexmo')constnexmo=newNexmo({apiKey:NEXMO_API_KEY,apiSecret:NEXMO_API_SECRET,applicationId:NEXMO_APPLICATION_ID,privateKey:NEXMO_APPLICATION_PRIVATE_KEY_PATH})nexmo.channel.send({"type":"whatsapp","number":"TO_NUMBER"},{"type":"whatsapp","number":"WHATSAPP_NUMBER"},{"content":{"type":"text","text":"This is a WhatsApp Message sent from the Messages API"}},(err,data)=>{console.log(data.message_uuid);});