How I Automated WhatsApp Messages with Node.js

Easy way to Automate WhatsApp using Node.js

Photo by Icons8 Team on Unsplash

Development Environment Setup

Let’s start by making sure we have the right software installed and set up that we’ll need to use for the rest of this article.

Sign up for Twilio and activate the Sandbox

Sending a WhatsApp message with Node.js

Now that you have a Twilio account and have activated the WhatsApp Sandbox, you’re ready to dive into some code and send messages! Start by opening your terminal and navigating to the directory where you want your project to live and running the following command to initiate a package.json file for npm to install dependencies:

npm init --yes
npm install twilio@3.30.0


const client = require('twilio')();client.messages.create({
from: 'whatsapp:+14155238886',
body: 'Ahoy world!',
to: 'whatsapp:+15555555555'
}).then(message => console.log(message.sid));
node index.js


Software Engineer | UI UX Designer | Tech Writer & better human | LinkedIn :

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store