engineer diaries Logo

Whatsapp Business API Integration NodeJs

by Priyanka Arora, May 21, 2020, 1032 Views, 1
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

2.Make Twilio Account

For Whatsapp business API integration in C sharp 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!

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

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

node app.js

Whatsapp Business API Integration NodeJs

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 🤓

Frequently Asked Questions

There is a big form to fill and verify detail of the owner as it contains sensitive information.

There are infact, and you can definitely use any.

Yes. But the account must be verified before itself.

Similar Posts:

Whatsapp Business API Integration In C#
May 21, 2020, 1032 Views, 1
Express Js Routing Tutorial | Beginners
May 21, 2020, 1032 Views, 1
Mysql with NodeJs Connection and CRUD
May 21, 2020, 1032 Views, 1
Sql Server with NodeJs CRUD Operations
May 21, 2020, 1032 Views, 1

Comments Section:

Viraj

Nov 13, 2020

Short and concise:)