Updated on March 7, 2024

Businesses are always on the lookout for ways to enhance customer engagement, improve response time and optimize resource allocation. One way to do this? Integrate WhatsApp as a biz-com channel and deploy enterprise-grade chatbots.

In this article:

Chatbots have a market size of $12 billion in 2023, expected to grow to $72 billion by 2028, according to this report by Juniper Research. As more and more customers look for instant resolution of queries, enterprises should embrace technology and ensure that they are at the forefront of resolving these queries. A good way that enterprises can achieve this is to deploy chatbots on WhatsApp, everyone’s favorite messaging platform.

These WhatsApp chatbots can be built in a multitude of ways, and building them using Node.JS is one of them.

And guess what? You don’t need to be a coding whiz to build one yourself! 

In this blog post, we’ll guide you through the exciting journey of crafting your own WhatsApp chatbot using Node.js. We’ll explore: 

  1. Why WhatsApp?:  Understand the unique advantages of building your chatbot on this widely used platform. 
  2. Node.js Power: Discover how this versatile language makes chatbot development accessible and efficient. 
  3. Step-by-Step Guide: Follow our clear instructions and code snippets to bring your chatbot to life. 

Why use Node.JS to build your WhatsApp Chatbot

  1. Node.JS has Asynchronous I/O, which is non-blocking, allowing chatbots to handle multiple concurrent requests. This is really important to manage large volumes of messages, in real-time, on WhatsApp.
  1. Node.JS has a huge ecosystem of libraries,modules and frameworks that makes rapid deployment and development of chatbots possible.
  1. Node.JS enables developers to use JavaScript on both server- side and client-side, meaning there is consistency in full stack development. This translates to less of a learning curve for developers.
  1. Scalability: Node.JS has an event- driven architecture, which means it can be used to build highly scalable systems. This feature is especially useful for large enterprises who serve an enormous customer base on WhatsApp.

As you can see,  Node.JS is a compelling choice when it comes to building an enterprise grade chatbot on WhatsApp. Let us now see how this is done.

Whether you’re a small business owner looking to streamline customer service, an entrepreneur with an innovative idea, or simply a tech enthusiast, building a WhatsApp chatbot is a rewarding experience. 

So, join us as we unlock the potential of conversational AI, one message at a time! Are you ready to create a chatbot that will revolutionize your interactions? 

Buckle up, and let’s begin!


Steps to Build Enterprise WhatsApp Chatbots in Node.JS

Step 1: Create a new folder and add a new js file into it.

$ mkdir hello_world
$ cd hello_world

Step 2: Create a js app file

$ touch app.js

As you already installed NodeJs previously, no need to install npm as it is already there.

Step 3: Install Dependencies

1npm install express

Once you finish the above dependencies installation, move to the next step where you will be creating the app and API.

Step 4: Create your App and API

Add the following code to your app.js file and save it

const express = require('express');
// Express Initialize
const app = express();
const port = 8000;
//create api
app.post('/hello_world', (req,res)=>{
res.send('Hello World');
app.listen(port,()=> {
console.log('listen port 8000');

Test the API response using Postman

Place this URL on Postman to check the response: http://localhost:8000/hello_world

API response testing using Postman

Once you have tested your code, it is now time to go to the next phase of the tutorial.

Moving on to the next step where we will need ngrok to host your code so we can access it via API calling from the different applications.

Step 5: Hosting your code

  • Download the ngrok
  • Locate the directory on the terminal

$ cd downloads

  •  Run the following command

./ngrok http 8000

Now, you are ready with the HTTPS webhook URL generated by ngrok.

host code by using ngrok for nodejs chatbot

Now, that your API can send the normal string/text messages, the next step is to send the data in a format that is defined by Kommunicate.

Here we have explained the format that is accepted by Kommunicate, check step: 3 and copy the payload, use it in your app.js file.

    "message": "Kompose!"
}, {
    "message": "Select the suitable option",
    "metadata": {
    "contentType": "300",
        "templateId": "6",
        "payload": [{
            "title": "Welcome Intent",
            "message": "Welcome Intent",
        }, {
            "title": "Fallback Intent",
            "message": "Fallback Intent"

This is what your updated app.js file looks like;

update app.js fie

Step 6: Create a bot and configure Webhook inside Kompose Settings Page

  • Navigate to the Kompose bot builder category and create a new bot by selecting the “Create Bot” button.
Step to create a bot from kompose

Navigate to the Kompose Bot Builder, select your bot, and click on the “Settings” option present at the top right corner.

create node js chatbot in kompose
  • Click on the Webhook option present on that page. Here, we need to put the Webhook Name and Webhook URL.

You will be copying the webhook URL from your ngrok server and nodejs app directory name.


  • Create an intent by clicking on the +Add button under the “Answer” section and “Train the Bot.” 

Here, I have created hello_world intent and added a training phrase as “Kompose”

Step to train your chatbot
  • Click on the “Bot Says” option and select the webhook that you created earlier. Here, I have selected the webhooktest created earlier. Now, click on “Train Bot.”
whatsapp chatbot responses testing
  • Now, initiate the chat from your WhatsApp to see the responses coming from your webhook.

If you have not integrated WhatsApp yet, check out the blog to integrate the Node Js chatbot into WhatsApp.

Whatsapp chatbot conversation

Voila. You have just built your WhatsApp chatbot in Node.JS.


There you have it! You’ve completed the journey of building your very own WhatsApp chatbot using Node.js. By now, you understand the potential of this technology to transform your interactions with customers and employees.

Frequently Asked Questions

1) Do I need to be a coding expert to build a chatbot with Node.js? 

While some coding knowledge is helpful, many libraries and tools simplify the process, making it accessible for those with basic programming skills. This guide provides step-by-step instructions and code snippets to help you get started.

2) Can I use this guide even if I’m not using WhatsApp Business API? 

While the guide focuses on WhatsApp Business API, the core principles of Node.js chatbot development can be applied to other platforms. However, specific code snippets and deployment steps may differ.

3) Can I use this guide to build a chatbot for other messaging platforms? 

While the specifics may differ, the core concepts and development approach can be adapted for other platforms like Facebook Messenger or Telegram.

4) Can I connect my chatbot to other platforms or services? 

Yes! Many APIs allow integration with other tools, expanding your chatbot’s capabilities.

At Kommunicate, we are envisioning a world-beating customer support solution to empower the new era of customer support. We would love to have you on board to have a first-hand experience of Kommunicate. You can signup here and start delighting your customers right away.

Write A Comment


Devashish Mamgain

I hope you enjoyed reading this blog post.

If you want the Kommunicate team to help you automate your customer support, just book a demo.

Book a Demo

You’ve unlocked 30 days for $0
Kommunicate Offer

Upcoming Webinar: Conversational AI in Fintech with Srinivas Reddy, Co-founder & CTO of TaxBuddy.