August 10, 2020
Whatsapp Business API Integration NodeJs

Whatsapp Business API Integration NodeJs

Whatsapp Business API Integration Node.js could have been an exhaustive process for any developer as per the latest norms you cannot begin the development process and designing the message template till you have verified business account for Facebook first and hence, Whatsapp account and the entire verification process could take from 2 days to 14 days. And to wait for 14 days to even start with the development for developers who are billed for hours of labor is not feasible. Because of this limitation, there are few third-party software that has let developers use the sandbox model in the development mode and begin the process without setting us an official business account manager. Blessing right! Here, we are using one of the many third parties available namely Twilio. Install the npm module package, and then start using the sandbox model straightaway. Though it has limitations as you can only test with one phone number which you have registered and very few messages before you verify the business account officially. But still, that’s the best and only thing available. So, let’s start with the tutorial.

1.Install npm module

The first step for Whatsapp business API integration node.js is to install the module. So, open Console and type the below command.

npm install twilio

Whatsapp Business API Integration NodeJs

2.Make Twilio Account

For Whatsapp business API integration in C# you need to have tokens. Next step is to sign up to twilio account and get twilio accountSID and AuthToken . It is 10 minute process as you need to verify your Whatsapp phone number too.

Go to site:https://www.twilio.com/

Signup, enter your phone number and other basic details and you would get credentials on the console screen, pretty straight forward!

Whatsapp Business API Integration NodeJs

3. Write the Code

Now, let’s begin coding! Add the following code to your node.js application

const client=require(‘twilio’)();

client.messages.create({

from:’whatsapp:+1415523886′,

to:’whatsapp:+919999999999′,

body:’Hello,there!’}).then

(msg=>console.log(message));

Note for Sandbox model from would remain to be twilio number from which you would even receive verification code on Whatsapp mobile, and also write phone number with the international code as above otherwise it would throw exception. 

4.Testing the Code on Whatsapp

Whatsapp Business API Integration NodeJs

on console run the node application and you should receive Whatsapp message on your device.

node app.js

5.Verifying Business Account

And, verifying business account is the last step how cool is that thanks to Twilio:P and it isn’t even sponsored post so!. But remember you can’t use sandbox on production also just a few test messages are allowed. Make sure to verify the business account following the official link and you got to be patient with this process.

https://www.facebook.com/business/help/2058515294227817?id=180505742745347

That was a short and complete guide on the Whatsapp business API integration Node.js Application. Hope it helps 🤓

Similar Posts:

 

 

admin

Engineer Diaries started with the need to bridge the huge gap in what we are taught vs what the industry demands. We are based in Delhi, India but our blog is for everyone, in and outside tech industry❤ Feel free to reach out to us at engineerdiaries@gmail.com for any business/personal query.

View all posts by admin →

Leave a Reply