How to create WhatsApp chatbot?

Whenever we think about chatbots, we think about python and Telegram! Telegram Messenger already supports Bots, but very few people know that bots are very much possible in WhatsApp messenger. And in this tutorial, we would learn to create a whatsapp chatbot

Emergence of WhatsApp chatbot

In today’s modern world most of the interactions among people are happening only in social networks. Now more transactions are possible on social platforms than websites.

Millions of FB Chabot’s succeeding in the business field. People have realized the benefits of using apps to connect with brands. WhatsApp is the next best platform to market products, brands, and services.

WhatsApp Business (counter app for businesses to interact with their clients) launched a beta test run of bots on the platform, which now has more than 3 million users. Chatbots which connect artificial intelligence with customer experience is an ideal choice for WhatsApp.

This adage signifies the importance of WhatsApp and its easy reach among the masses. Hence chatbots built on WhatsApp could be a boon to any business.

- Advertisement -

As of now WhatsApp for enterprises business is still in beta and is not available to the general public. There is no official WhatsApp Business Open API at this point.

Only from September 2018, WhatsApp started coming out with their new business features for 90 selected partners. But with their overwhelming success, they have now announced the expansion. Twilio is having an official WhatsApp API.

Hence it provides the right platform for chatbots to develop businesses WhatsApp being the messaging app for more than 1.5 billion people is the right choice to build chatbots.

The rapid growth speed of WhatsApp is due to its ideal components. There are no ads and the best user experience than any apps. It is only because of their focus on their service for simplicity, utility and quality has made them be where they are now.

WhatsApp Growing Tools for Businesses:

Recently WhatsApp is building new tools to facilitate business communications to be better with each other. With its launch of WhatsApp Business App, many people were able to have business chats quicker and easier than ever before.

You Need To Know About Mobile App Development. It will help you to decode the WhatsApp Business app from technical prepstecive.

The Salient Features Include:

Request for Helpful Information:

In the cases of boarding passes or even shipping confirmations can be sent on WhatsApp. It is possible by giving the mobile number to the business or their website or app or even in their stores for posting the information.

Initiate Conversation:

Provision for click to chat buttons in the website or Facebook advertisements makes it easy to message a business quickly. It is true to the words of Mark Zuckerberg :

“You should message a business just the way you should message a friend.”

To Get Support:

With WhatsApp, businesses can provide real-time support by answering questions to solve issues about products, and services.

End-to-end Encryption:

These business messages have an end to end encryption. It will protect from cluttering, and it is possible to block any business with the tap of a button.

Best Business Profiles:

A company can create business profiles using WhatsApp which includes::

  • Addresses of companies
  • Detail description of companies
  • Company Emails
  • URL of the company’s website
  • Company working hours

While adding company addresses, it is possible to link with Google Maps. It enables users to get directions to reach them by a click. It can increase the user’s loyalty for brands and gives a familiar face and identity.

Quick Answers:

Quick replies enable saving and re-sending messages for fast answers to FAQs. Creation of quick responses to send messages includes:

  • Thank you
  • Ordering instructions
  • Payment information
  • Discounts

Greeting Message Setup:

Greeting messages are the initial response of chatbots which could make or break conversations. Creating greeting messages by WhatsApp enables businesses to greet users during the start of a dialog with the company. It creates a warm welcome to the potential customer without delays and waiting times.

Away Message Setting:

Like greeting message, an away message is equally important. It could be due to late hours after the closure of company timings or for other reasons it could be in a soothing way.

Contact Labels:

It is easy to group and organize contacts in WhatsApp for business to make their searches easy.


Access of critical metrics is easy with WhatsApp for business. It may be the messages sent, delivered and read.

The above finding establishes the importance and cost-effectiveness of chatbots in business. It is the same functions and objectives of WhatsApp bots. They also provide significant benefits for businesses and consumers alike as that of chatbots.

So, What is WhatsApp Chatbot?

WhatsApp chatbot is a software program which runs on encrypted WhatsApp platform. WhatsApp users can communicate with a chatbot through the chat interface as they would talk to a real person.

For knowing more about Chatbot, you should search for In-Depth Guide Of Chatbot in Google. It will help you have a basic idea about the concept.

Advantages of Having an Own WhatsApp Chatbot:

WhatsApp chatbots are the buzzword of business nowadays. There are several advantages of owning a WhatsApp Chatbot which include:

  • Enables to assist customers on their preferred platform which they use daily
  • It supports the customers to respond to questions right away.
  • The real-time confirmations are possible with instant answers to the customers’ questions.
  • Customer experience enhancement is sophisticated with WhatsApp chatbots.
  • Leads customers down the sales funnel by enabling them to take fast actions.
  • It builds trust and loyalty with customers.
  • Personalization of customer experience is possible by customizing the script the WhatsApp uses
  • The customer communications are more comfortable and secure with an end to end encryption in WhatsApp.

Creating WhatsApp Chatbot:

Developing WhatsApp chatbot is easy, but it is necessary to have a solid plan and aim to build a sophisticated one. Partly it is like creating Facebook Messenger Bots. But with WhatsApp, there is more flexibility in customization. Also getting the approval of WhatsApp is necessary for building a recognized WhatsApp without being blocked by it.

There are two ways to build a stable and long-term usable WhatsApp chatbot. The first one is created by applying for WhatsApp Business API. It takes time to get the approval for making this kind of WhatsApp chatbot. But the waiting time can help in developing a WhatsApp Chatbot with all the requirements as per the need of it.

The second way is to get integrated to Twilio with its API for WhatsApp for early access. It is mainly done to save time for approval and verification by WhatsApp. Twilio has solved this problem with its new Sandbox. It also avoids waiting for the support from WhatsApp by allowing to prototype.

WhatsApp Chatbot with WhatsApp Business API:

With WhatsApp Business API it is possible to communicate with people through their phone numbers and also with their first interactions.

It even by taking complete control of their inboxes blocks a brand. The messages allowed to receive is also controlled by it. It enables to send outbound messages to clients as per its set of requirements and guidelines.

But the big issue is WhatsApp Business API is only to preferred 90 multinational and big enterprises. It is to maintain its uniqueness as a platform without much advertisements and to put users in charge of their inboxes. But, later the approvals will be quicker to enable smaller enterprises to avail the facility.

WhatsApp commits the following with its Business API:

  • Trust and safety of the users’ personal space and data
  • Enables to exclude spam
  • Increases the level of trust of branded messages that a user receives
  • Security of the messages is safe by sending them through API with an end to end encryption.

Step by Step Guide to Having WhatsApp Chabot with WhatsApp Business API:

Step -1:

Applying for WhatsApp Business API:

It is necessary to use for WhatsApp Business API to create a WhatsApp chatbot. There are two options which include;

  • As an end client
  • As a solution provider

The application should have the following:

  • Name of the company
  • Website URL
  • Name and information of the company representative

After the review and approval by WhatsApp, the company can start using the WhatsApp Business API.

Step — 2:

Selecting the Right Service Provider:

There are several external service providers, and new better ones are appearing every day. Hence to choose the right service provider is essential

The following are the services of the right service provider:

  • The sender phone number associated with the chatbot specified on the service panel.
  • For filtering the incoming messages not directed to the specified number, it is necessary to make sure that the provider is displaying it as integrated or connected.
  • Copy paste the provider API key from their panel. Make sure to copy the full value of the provider panel to create the connection between the application and the provider.
  • The URL is copied inside the selected provide panel as needed by the provider to configure the integration settings. It is the bridge between the provider and the application for sending real-time updates for all messages through WhatsApp.
  • Many providers will have the capability of integrating with the existing number without the need for a new number.

Step- 3:

Think About Dialogue & Conversation:

It is of utmost importance to decide on what the chatbots need to answer the customers’ questions. Hence to achieve the business goals a mini checklist where, how, who and what the chatbots are going to talk about is necessary.

For doing this, the following questions arise before setting up the WhatsApp chatbot.

  • What is the goal for marketing or another purpose for the creation of the chatbot?
  • What type of tone should it talk with its customers?
  • What kind of talk should it have with the customers?
  • Whether the dialogue should be freeform or guided one?
  • What is the plant of the chatbot dialogue?
  • How will the chatbots respond if it is not able to answer the customers’ questions?

Step — 4:

Selecting a Chatbot Application & Hosting on a Database:

A proper chatbot application can save a lot of time for creating WhatsApp chatbot.

There are many excellent applications available so that it is not necessary to start from scratch. Also, to host it there is a need for a database.

Only it will ensure that the end to end encryption maintained for the security of the messages.

To create mock-ups before the final product, it needs a proper chatbot application. It saves further investing in money and time into the production of the WhatsApp Chatbot.

Step — 5:

Testing of the WhatsApp Chatbot:

To enhance the customer experience and have a high-quality WhatsApp chatbot it is necessary for testing it. It is by asking questions which the customers may request the chatbot.

All types of customers’ problems exhibited to fix errors. After setting the mistakes, the test should be rerun for the best functionality.

WhatsApp chatbot with Twilio:

Stich in time saves time an old saying of the necessity of being ready to save precious time. Since rather than waiting for the time taken for approval of WhatsApp many companies are now using Twilio for developing WhatsApp chatbots.

Step by Step Guide to Create WhatsApp Chatbot with Twilio

Step -1:

To develop the knowledge of coding is necessary or it is better to hire a developer to do it. Many people Hire A Chatbot Developer to build WhatsApp chatbots.


Signing Up with Twilio:

Signing up with Twilio is the next step, and the best thing is, it is free to sign up with Twilio, and there is no need to use a credit card for it. It is why many chatbot developers use Twilio for developing WhatsApp chatbots. The following are the steps to do it:

  • After opening the Twilio website, click the “Try the Sandbox today” button
  • Sign up for Twilio account
  • For identity proof, it is enough to provide the phone number to verify the identity
  • Then go to the Products section, then Programmable SMS and then navigate to the Twilio console
  • It is here it is necessary to set up the Sandbox for the new WhatsApp number and a Sandbox joining code. As per the instructions, complete the setup of the testing Sandbox.
  • Send the first message by running through the ‘quick start.’ There are also the following in the Sandbox:
  • A total of seven quickstarts showing a simple WhatsApp integration
  • Uses six popular web languages
  • A cURL.

They will contain the guidelines and general setups to help start fast. Further information for learning more about using Twilio will be in the API overview docs.

Step — 3:

Project Name:

Naming the project is after verification of Phone number by WhatsApp. And then after, select Products > Programmable SMS. Do not go to the steps of adding teammates, because they are not needed. Noting some authentication keys will help in building the WhatsApp chatbot.

Step -4:

The Final Step is Setting Up the WhatsApp Sandbox

By choosing any number and implementing the Sandbox instructions on the page is possible. By trying sending notifications to the same amount or Sandbox, it is possible to build new useful tools. There are also many other mediums to message by Twilio.

By going back to the WhatsApp Sandbox, the webhook URL is easy to fix. On the preview panel, only this URL is visible. As for others, they have to join the Sandbox first by sending a message to use this WhatsApp chatbot.

Limitations of Twilio Sandbox:

  • Messaging is possible only to users who have joined the Sandbox
  • With Twilio restrictions on the Sandbox, only one message is likely per second
  • Also, Sandbox numbers branded as Twilio numbers
  • During a WhatsApp session just it is possible to use pre-registered templates with the Sandbox for outbound messages
  • Enable the Twilio numbers for WhatsApp to launch the product by filling a simple form to get the updates about the access

Step by Step Guide to Building a WhatsApp Weather Chatbot with Twilio, Dialogflow& PHP:

It is easy to construct a WhatsApp weather chatbot using Twilio, Dialogflow, and PHP. Dialogflow is an NLU or natural language understanding engine powered by Google. It allows building conversational interfaces. To develop a conversational experience for a WhatsApp weather chatbot and a PHP fulfillment webhook is necessary.

The Following Is the Step by Step Guide to Building WhatsApp Weather Chatbot:


  • An installation of ngrok & composer
  • A PHP development environment
  • Twilio, WhatsApp, Google & OpenWeatherMap Accounts

Step -1:

Setting Up of Development Environment:

The first step is to set up a new directory to host code. Name as per choice and create two files.

  • webhook.php
  • .env

The first file webhook.php is, and the other file is for storing sensitive credentials.

By navigating to the API keys page in the OpenWeatherMap account, copy the API keys to the .env file.

By retrieving the API key, it is possible to read the env file by the developing app. By running a command from the terminal inside the project, it is possible


Setting Up the Twilio API WhatsApp Sandbox:

Activate Twilio Sandbox with WhatsApp to create a new programmable SMS project from the dashboard. As of now, it is free so to add further changes later.


Setting Up the Dialogflow Account:

By logging into the Dialogflow, from the landing page click sign up for free. Sign in with the google account and create a new agent and name it like ‘weather.’

The Default Welcome Intent provided by Dialogflow is in use now. From the left menu click ‘integrations.’

Under integrations, there will enable Twilio input in which at the bottom there will be request URL. Copy this URL to the left open Twilio account in the Sandbox configuration.

Dialogflow is capable of handling all incoming messages from the WhatsApp Sandbox. Then they are saved by a click.

Now navigate to the console dashboard to get the Account Sid and AIth Token. The credentials then are easily entered in the Dialogflow model. It is along with the WhatsApp number for the Sandbox.

The Dialogflow is now set up and also integrated with WhatsApp. To test typing the word ‘hi’ on WhatsApp will get a response from Dialogflowdefault welcome intent.


Creating a PHP Webhook:

In the first step, we opened a file webhook.php and kept it open. Only by understanding the request object from Dialogflow, it is possible to create a webhook.

The user will enter a text similar to “How is the weather in LA.” Dialogflow will provide a parameter for the given city name called geo-city.

The code is then copied and checks if there is a city provided by the user. Calling OpenWeatherMap is the next step.

As soon as we get results, it becomes an SMS response. To get multiple opinions many references checked on samples on how to build fulfillment response.


Addition of Webhook to Dialogflow:

For enabling webhook, it is necessary to click the fulfillment menu in Dialogflow. Then the URL from ngrok is entered followed by the path to webhook PHP.

Before proceeding make sure you save it. Now create an intent like ‘weather information.’ Add this to the following phrases:

  • Weather in LA?
  • How is the weather in LA?

As mentioned earlier the geo-city parameter is retrieved from the request object. Dialogflow while entering the training phrases creates it that contains the name of the city. And at last the webhook fulfillment is enabled for this intent and saved.

Step — 6:

Test Webhook:

Since the webhook is set up, it is time to test it in WhatsApp. Question the WhatsApp chatbot about the weather in different cities to get the correct answers.

Now a simple Whatsup weather chatbot is ready to use by utilizing WhatsApp, Dialogflow, and PHP. Many such WhatsApp chatbots for different kind of applications like online store chatbot, or restaurant checking WhatsApp chatbot is possible to develop.


The New Avatar of WhatsApp in the Form of WhatsApp Chatbots:

Newly developed WhatsApp Business API given to selected businesses for improving their functions. Chatbots with the capacity to reduce 30% of expenses is part of WhatsApp chatbots to facilitate customer interactions.

Chatbots is the chat interface of WhatsApp for better customer interactions. They could benefit better from WhatsApp chatbots for developing the business to the next level.

Sales & Service Business to Benefit from WhatsApp Chatbots:

WhatsApp’s easy integration with many other technological tools like Dialogflow, PHP, and many others make wonderful WhatsApp Chatbots of the future. It is the reason many businesses hire chatbot developer for their chatbots.

Hot Topics

Related Articles