Blog
>
Messaging Experience
>
How to Create WhatsApp Bot For Your Business & Test It in Real Time!
...

How to Create WhatsApp Bot For Your Business & Test It in Real Time!

Illustration: Jana Pérez
how-to-create-whatsapp-bot

Since the launch of WhatsApp Business API, brands have been competing to create a WhatsApp bot to enhance their customer experience. Now, that the API restrictions losend a bit and WhatsApp is becoming more and more forthcoming to all kinds of businesses, the competition’s gotten even fiercer. 

If you are thinking that having a WhatsApp bot would be great but the road to launching one is too winding, don’t abandon all hope just yet. 

Landbot's chatbot builder offers a cost-effective no-code solution for WhatsApp automation. Moreover, the builder features have never been more intuitive both for the bot makers and the end-users.

Hence, we put together this article to guide you through the process of building a WhatsApp bot step-by-step!

What is a WhatsApp Bot?

A WhatsApp bot provides customers with a real-time automated conversational experience directly on the messaging app, using WhatsApp Business API integration. Chatbots on WhatsApp can be rule-based (composed of decision-tree-type interactions offering more structured experience) or NLP-based (using natural language processing for more or a more human conversational effect).

The major advantages of a WhatsApp chatbot include:

  • Being able to communicate with the customer base promptly and asynchronously (at a time most convenient to the customer);
  • Getting in touch with customers without forcing them out of their comfort zone (via an app they use daily);
  • Delivering a personalized experience with every interaction thanks to accurate user history and data collection.

Besides customer support, a WhatsApp bot can be used for sales and lead generation, product promotion/recommendation, customer engagement and feedback, booking, internal company communication, and so forth. 

Industries most likely to profit from a WhatsApp chatbot include real estate, travel & hospitality, finance, education, online retail and likely any type of subscription-based business.

Who Can Build WhatsApp Bots?

Since the launch of WhatsApp Business API back in August 2018, a wave of excitement swooped over the business world. Though not everyone was instantly eager on the idea, seeing WhatsApp’s 1.6 billion monthly active users (MAU) in 2019 did the trick.

‍In 2021, the stats are ever more convincing showing WhatsApp's MAU reaching an incredible 2 billion which is significantly more than any other messaging app on the market. Truth be told, the promising WhatsApp statistics have been hard to ignore even before the messaging app opened for business.

Still, even though WhatsApp did open its doors to businesses, the API integrations is not up for grabs just for anyone.

WhatsApp Business API requires businesses to pass through an application process prioritizes medium, large and enterprise-size businesses in selected industries. Before you can grace your audiences with an official WhatsApp chatbot, you need to:

Without completing these steps launching your chatbot won’t be possible whether you are doing it solo or using a chatbot solution like Landbot.

HOWEVER!

There’s a way you can build and test a WhatsApp bot BEFORE that process is complete!

Just continue reading if you are interested in how it works.

How to Create a WhatsApp Bot without Coding & Test As You Go

To be able to follow this tutorial you need to create a free account with Landbot.

‍Landbot is a verified WhatsApp API solution provider. It's also the best chatbot maker for the job since it hardly requires any coding.

The initial signup is completely free, no credit card is required and a 5-day free trial will enable you to get access to all the features and learn how to make a WhatsApp bot without coming anywhere near a single line of code.

Answer the signup questions to personalize your experience. And, once you are done, let the app take you for a little tour and intro to the builder.

landbot signup

Whether you take the tour or skip it is up to you. But it’s a good way to get familiar with the drag and drop workings of the builder which looks and is the same whether you are building a web, Facebook Messenger, or WhatsApp bot.

After the tour, exit the builder and go to the main dashboard.

You can get a good idea of what steps you need to take to create and test your bot in the video below. Though, for a more detailed guide, follow this tutorial to the end.


NOTE: This tutorial explains how to create a rule-based WhatsApp chatbot using a decision-tree-like structure powered by integrations. If you are interested in creating an NLP-based AI assistant, check out our guide to building Dialogflow WhatsApp chatbot.

1. Set Up WhatsApp Bot Canvas

To set up your canvas simply click on the “Build a Chatbot” button in the upper right corner and select WhatsApp as the channel and go straight to the building.

create whatsapp bot

After that, you’ll be able to select to build a bot from scratch or use a pre-designed template.

whatsapp bot templates

If you wish to play around and test the experience immediately, you can go ahead and activate one of the templates. Otherwise you can start completely from scratch by slecting the button “Start from scratch” in the upper right corner. 

Whichever option you choose, you will be prompted to setup your WhatsApp testing channel in order to test your bot as you go.

2. Set up WhatsApp Testing Channel

To create your personal WhatsApp Business Testing channel, all you need to do is click on the Channels icon on the left side of the dashboard.

Next, select “WhatsApp Testing” from the menu:

setup whatsapp chatbot testing

Click “Add New Testing Number”:

whatsapp chatbot testing

Remember to input your phone number with country code and click “Confirm”.

All in all, you can add up to 10 test channels. They will appear as follows:

whatsapp bot testing channel

To link any of your test numbers with a particular bot, select the channel and open the selection under “Linked Bot”:

link whatsapp bot to channel

A window will pop-up allowing you to connect the number with any multi-channel bot you created on the Landbot platform: 

test whatsapp bot real time

Make your selection and click “Link Existing Bot”.

To start the testing, send a WhatsApp message to Landbot’s official WhatsApp testing number from the same number you associated with your personal testing channel.

WA test channel setup

For example, I linked my number to an eCommerce feedback template bot and texted “Hi” to activate it. Soon, the bot replied: 

whatsapp bot landbot template

3. Create Your First Block

As an example, I will throw together a simple product survey chatbot as it makes it easy to demonstrate a variety of features.

So, as a starter, you need a conversation opener, you can kick off with a question or a message as I did below:

set-up-welcome-message-block

As you can see, instead of simply saying the impersonal “Hi there!” I am using the @name variable to pull the user's real name.

How?

When people opt in to communicate with you via WhatsApp, besides their telephone number, you also get access to their WhatsApp name. Hence, you are free to personalize from the beginning.

4. Ask a Question (Text)‍

The first question type I will share with you is a simple open-ended question.

Drag an arrow from the green point of your message block and select “Text Question” from the menu:

The “Text Question” block has two fields the configure:

  • The question
  • The variable under which you want to save the user’s answer
text-question-block

Since at this point the answer doesn't really contain important information and is more of a customer engagement prompt, I left the variable on the default "@text" setting.

5. Ask a Question (Number)

Next, I wanted to know the age of the user, as I don’t want to collect data of those under age.

When you want to collect a numerical answer, the best question block to choose is “Number” - naturally.

number-question-block

Since I will be asking for users' age, I will create a new specific variable to capture this data.

To do that, just type the desired name of the variable and click “CREATE”.

configure-number-question-block

Note: If necessary, you can further customize the “Number Question” block by activating the “Advanced Options” field. It allows you to set min and max values as well as prefixes or numeric formats

number-question-block-advanced-options


6. Set Up Conditional Logic

Let’s say I want to differentiate between people who are 18 and over and the rest. To do that, all I need is to set up a condition that will split the conversation flow into two branches.

Draw an arrow from the last block (age) and select “Conditions” from the blocks menu.

In this case, I want to condition the @age of the respondent so I select it as the variable to condition. Next, you can choose what kind of condition to apply:

  • Equal to
  • Not equal to
  • Contains
  • Greater than
  • Less than
  • Is set
conditional-logic

I selected, “Greater than” and set the last field to “17” so my condition looks like this:

conditional-logic-setup

IF @age is GREATER THAN 17 - meaning the condition is “TRUE” (green output), I will allow the respondent to continue. If it is “FALSE” (pink output) they will take a different path:

conditional-logic-alternative-path

For the negative output, I chose a simple message block to inform the user he or she can’t participate in the survey and used the “Close Chat” function to mark the conversation as closed/locked in the system.

7. Ask a Question (Buttons)

In the past, WhatsApp interface didn’t allow the use of buttons. When designing a rule-based bot brands had to rely on the Keyword Jump feature or use UX tricks such as numbered choices (see example below):

whatsapp-bot-message-example

However, things have changed. WhatsApp made some updates to the UI and so, buttons are no longer off limits. In Landbot, you can enjoy buttons by using the “Reply buttons” feature: 

whatsapp bot buttons

So, to get some button-action in my bot and assess participants in more detail, l asked about their experience with tech:

whatsapp button choice interface

To save the user answer under a specific variable, scroll down the buttons editor and create variable that best captures the data you are asking for (you should do this for every question block that collects relevant data):

variables

I immediately went to test the experience and this is how it looked on WhatsApp. This is how the selection looks like: 

whatsapp bot buttons ui

And, when the user selects one of the options, they’ll se this: 

whatsapp bot buttons response

8. Add Media

Although WhatsApp only has the basic button feature and none of the fancier UI available for the web or Facebook Messenger bot, you can still have fun with content formats and use videos and images to help your cause.

After learning about the @tech_profile of the participants, I wanted to bring the survey without splitting the flow, so I dragged the arrow from the "Default" button. This means that no matter what the user answers all options lead to the same next step.

I chose the Message Block as it's ideal because of its flexibility. When you click on the “MEDIA” option, you can switch from text and, instead, easily upload a file, share a YouTube video, image or a rich URL link.

add-media-to-whatsapp-bot

Of the options available, I chose YouTube and just copy-pasted the link of the video I want my bot to share.

Then I added a simple prompt asking the participants to watch the video before proceeding to answer the rest of the questions.

build-whatsapp-chatbot-with-media

Next, I followed the video with three open-ended questions using the Text Question blocks, making sure each answer has its own variable.

whatsapp-chatbot-question-sequece

9. Export Collected Data: Google Sheets

Before being able to integrate a Google spreadsheet into your WhatsApp bot, you need to create, well, the spreadsheet on your Google Drive.

I created a simple sheet to collect all the data by WhatsApp bot asked about in the conversational survey.

integration-google-sheet

When you have this ready, go back to the builder, draw the usual arrow and select “Google Sheets” integration from the list.

google-sheet-integration

Click “Add Account”.A new tab will load asking you to give Landbot access to your Drive.Once done, the account will appear inside the integration.

whatsapp-bot-google-sheets-integration-set-up

Click on the “Select the Spreadsheet” and choose the one you want to integrate from the list:

whatsapp-bot-google-integration-set-up

After that, the builder will ask you to also indicate a specific sheet within the selected spreadsheet which can come in handy if you have multiple ones within a single spreadsheet.

When that is all done, it’s time to configure the action I want to carry out:

whatsapp-bot-google-sheets-export-data

There are three different actions available. I can insert new data, update data or retrieve data. For the survey use case, I selected “Insert a new row” since every new submission will be new data.

Last but not least comes the fun part of pairing column names with the variables under which you stored user answers:

assign-variables-to-columns

Just keep pressing the PLUS icon until you have assigned all the variables to their designated columns.

10. Send Your Team an Email Notification

If you want to be informed about the success of your survey (or maybe a sale or an incoming support ticket), Landbot’s lets you quickly set up an email notification.

Draw an arrow and select the “Send an Email” option from the block menu.

send-an-email-from-bot-flow

First, decide if this email notification will go to a team member or the user. I wanted to receive a notification about the survey submission so I chose the “Your Team” option.

Next, configure the email address, email subject, and message in the email.

And that's it.

11. Offer Human Hand-off Option

Transfer to a human agent is more typical for FAQ bots rather than surveys but I really wanted to show you how easy it is to set up with Landbot:

So, after I sawed all the data in Google Sheets and sent myself a notification, I thanked the user and offered him the following options using Buttons block once again:

bot-to-human-handoff

Option one offers access to learning resources, option two a chance to talk to an agent, and option three lets the user put an end to the conversation.

To set up the chatbot-to-human handoff, draw an arrow from the second “Talk to an Agent” option, and select “Human Takeover” from the menu.

confugure-human-takeover

If you have more agents, you can assign the responsibility for a specific chatbot to a specific agent. If you don’t assign the takeover to anyone, the bot will select the agent with the least number of conversations automatically. And that is it to be honest.

To account for a situation when no agent is online, I continued the flow with a simple message:

agent-not-available

Since the conversation is happening on WhatsApp, the user doesn’t have to wait impatiently on the desktop, so a little waiting time is really not so inconvenient!

12. Set Up Slack Notifications

I have a little bonus up my sleeve!

If you don’t have agents sitting on the Landbot chatbot platform all day long you might want to notify your agents when someone wants to talk to them.

Luckily, Landbot can send notifications via the world's most popular business communication app - Slack.

‍You can use it for anything… notifying your sales team about every new lead, a new purchase, new subscription, or notifying agents about new live support tickets.

In our example, after the user indicates the need for live agent support, you can easily send a notification to the respective Slack channel:

  • Break the green arrow connecting your “Contact Support” and “Human Takeover”
  • Search for “Slack Notification” block
  • (If not set up already) connect your Slack account to Landbot
  • In the “Choose an Option…” field select an existing Slack channel or a specific person from whom you want to receive the notification
  • In the field below, enter the message you want to appear in Slack
slack-integration
  • Click save
  • Connect the Slack block with “Human Takeover”
slack-notification-integration-set-up

Once again, that is it!

Pretty simple right?

Right now, all I have to do is define a flow for the other two responses of the button choice question, but you already know the different features I could use, so I won’t waste space on it in the tutorial!

Let’s go straight to the best part - the testing!

13. Test Your Chatbot!

I am only testing my chatbot after I have built the whole flow.

But, to be honest, you can do it at any point throughout the creation process, as long as you save your progress by clicking the SAVE button in the upper right corner of the builder interface.

The testing feature is especially handy because it gives you an opportunity to review the final customer experience, check up on integrations, and catch possible errors before launching the bot to your customer base.

My integrations were successful as my spreadsheet updated with submitted answers:

spreadsheet-inegration-testing

And I received an email notifying me about the submission:

email-notification


14. Keep Exploring!

Though the features you saw in this article are powerful tools in creating WhatsApp bots, they still only scrape the surface of what you can achieve with Landbot.

So, roll up your sleeves and keep exploring… For instance, thanks to the Dialogflow integration you can use Landbot to build smart NLP bots without coding.

To Sum Things Up...

WhatsApp chatbots allow you to deal with incoming messages in real-time.

Thanks to smart solutions, learning how to create a WhatsApp bot doesn’t have to be rocket science nor does it have to involve artificial intelligence to be useful business-wise (check out some WhatsApp bot examples to see for yourself!).

The visual editor and builder even allow you to master formerly coder-only skills such as integrating webhooks!

If you are tired of relying on WhatsApp web for business, check out our WhatsApp Solution features or sign up and start shaping the future of chatbots with your own assistant today.

It's time to leave the programmable SMS in the past and revolutionize business-customer communication.


Related Articles

Launch an interactive WhatsApp chatbot in minutes!

Get started with a ready-to-use chatbot template

Pick a ready to use chatbot template and customise it as per your needs.