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

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

So… You are wondering how to create WhatsApp bot.

The good news is, you are in the right place!

Still, I feel like I should give you a heads up. The guide you will find here is significantly different from anything else you come across when you google “how to create WhatsApp bot.

We won’t:

  • Give you ridiculously vague advice like “Apply for API and find a chatbot maker…” 🤷‍♀️
  • Trick you by simply relabelling a post on how to create a chatbot conversation to “How to Create WhatsApp chatbot conversation” and call it news 👎
  • Drown you in technical gibberish and endless lines of code 😳

We understand the hype is swelling and the stakes are high but articles hastily patched together aren’t going to help anyone.


What is a WhatsApp Bot?


A WhatsApp bot (or WhatsApp chatbot) is an automated conversational software program businesses can integrate with WhatsApp messaging app, using WhatsApp Business API. A WhatsApp chatbot enables brands to communicate with their customer base instantly, asynchronously (when it suits the customer), and in a personalized way without making their audiences to leave their comfort zones. Chatbots on WhatsApp can be rule-based (more practical and structured) or use NLP for a more natural conversational effect.

Besides customer support, a Whatsapp bot can be used for lead generation and sales, product recommendation, customer feedback collection, booking, internal company communication, etc. Industries most likely to profit from a WhatsApp chatbot include the real estate, travel & hospitality, finance, education, and eCommerce.


Who Can Build WhatsApp Bots?


Since the launch of WhatsApp Business API back in August 2018, a wave of excitement swooped over the marketing world. Though not everyone was instantly eager on the idea, seeing the 1.6 billion WhatsApp’s monthly users in 2019 did the trick. In 2020, the stats are ever more convincing showing WhatsApp’s MAU reaching an incredible 2 billion.

Promising WhatsApp statistics were hard to ignore once the messaging app opened for business.

However, the API key is not up for grabs just for anyone.

The whole service is still in the BETA stage. Hence, Whatsapp Business API, still not open to the public, requires businesses to pass through an application process that currently prioritizes medium and large and enterprise businesses in specific industries.

In this sense, even the vaguest of WhatsApp articles are right. Before you can grace your audiences with an official WhatsApp chatbot, you need to:

Without completing these two 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 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, naturally, you need to create an account with Landbot.

Don’t worry, it’s completely free, no credit card is required and a 5-day free trial will enable you to get access to try out all the features and learn how to make a WhatsApp bot without coming anywhere near a single line of code.

signup-with-landbot

Answer the sign up questions to personalize your experience.

sign-up-with-landbot

And, once you are done, let the sign-up process take you straight to the builder for a little tour and intro to the builder.

landbot-tutorial-whatsapp-chatbot builder

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, Messenger or WhatsApp bot.

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

1. Set Up Your WhatsApp Bot Canvas


There are two ways you can start building a chatbot for WhatsApp.

Firstly, you can simply click on the “Build a Chatbot” button in the upper right corner and select the WhatsApp as the channel and go straight to building.

create-whatsapp-bot-landbot

Secondly, you can start by connecting your phone number to Landbot and creating your own personal WhatsApp Testing channel.

Click on the Channels icon on the left side of the dashboard.

activate-whatsapp-bot-testing

Next, click “Try it for Free” and before you enter your number, accept terms and conditions:

whatsapp-testing-number-verification

Insert your phone number with country code and click “Confirm”.

whatsapp-testing-number-verification

Once your number is approved and test channel created, click open the section “Linked Bot”

whatsapp-testing-link-number-with-bot

You will notice there is only one “WhatsApp Testing – Bot” available on the list. This is only because you haven’t created any WhatsApp bots yourself but as you go and create more, you will be able to link and test any of your bots.

For now, select the default testing bot and press “LINK BOT”.

link-testing-number-with-bot

Save changes.

And… soon you will receive a message on your WhatsApp, from the bot you’ve just selected.

whatsapp-bot-testing-channel

Go on and chat with it a bit!

Though, when your attention is back at the desktop, you are ready to go to the main dashboard once again.

There, you’ll notice, a new (WhatsApp) bot appeared on your list.

whatsapp-testing-bot

2. Start Building the WhatsApp Bot


Click on the bot and enter the builder.

First, you will see a little disclaimer that not all Landbot features are usable in WhatsApp because of the restrictions of its interface. This concerns UI related features such as button responses.

build-whatsapp-chatbot-limited-features

Click “Got it!” and behold, in front of you is the humble anatomy of the bot with which you just chatted on your WhatsApp.

whastapp-testing-chatbot-flow

You can check out this flow and play around with… though in this tutorial, I’ll delete the pre-designed demo and start from scratch to show you some of the best WhatsApp bot features for the ultimate flow.

3. Create Your First Block


As an example, I will throw together a simple product survey bot 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 @name variable to pull the user’s real name.

How?

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

4. Ask a Question (Text)


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 an engagement prompt, I left the variable on 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 setting 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)


I know, I know… I did say the WhatsApp interface doesn’t allow the use of buttons. However, that doesn’t mean you have to give up the idea of giving your users set choices completely!

“Button” options questions are possible. The only difference is that on the WhatsApp interface, the buttons will appear in the form of a numbered list (see example below).

whatsapp-bot-message-example

Now, l asked my survey participants about their experience with tech to assess their background. Since there are no buttons in WhatsApp UI, like in the example above, I gave my users a little hint on how to proceed:

butons-question-block

To save the user answer in the Button question under an easily recognizable variable, click on the three dots in the upper right corner of the block:

buttons-block-save-the-variable

So, when the user types in the number 1, 2 or 3, each answer can take them down the same or a different path based on the answer.

BUT as you may have noticed, my little hint didn’t just say numbers. It also mentioned the option of typing “one of the words in bold”(You can notice some of the words in the button answers are surrounded by ** so they appear bold on the WA interface). This brings me to another cool feature I wanted to show you.

8. Set Up Keyword Jump


The keyword jump recognizes a specific word or a phrase in the user’s natural input and uses it to progress down a specific path.

To set up a Keyword Jump, draw an arrow from the purple DEFAULT button, and select keyword jump from the list of blocks.

set-up-keywrod-jump

First, I choose the variable under which to save the response.

In this case, I chose to use the same variable as for the Buttons – @tech_profile – as it concerns the answer to the same question, just in a different format.

Next, I simply add the keywords I highlighted in the buttons:

configure-keyword-jump

Tip: If you don’t want your users to be constricted by the options completely and risk losing interesting data, you can add an “other” option to the Buttons and Keyword Jump and follow it with an open-ended question block to collect the user’s own definition.

9. Set a Variable


At this stage, the survey participant would have shown me his or her tech background. However, the answers in the buttons are too wordy and I want to differentiate the tech profiles with simple labels.

It’s time to use the “Set a Variable” Block. This one allows you to assign a specific value to your variable. (If your variable is numerical, you can even use it to make calculations!)

I used the block to assign a simple tech profile label.

set-a-variable-block

As you can see in the image, the first button choice and the keyword corresponding to the first button choice both point to the same “Set Variable” block which sets the value of @tech_profile to “Techy”.

I repeated the process for each option, assigning “Works in Tech” value to the second option and “Uses Essentials” to the third option.
set-a-variable

10. Add Media


Although WhatsApp doesn’t have any of the fancy buttons and carousels of web or Messenger bots, you can still have fun with content formats and use videos and images to help your cause.

After setting the individual values for @tech_profile, I wanted to bring the survey back to unified flow so I set the arrows from each “Set Variable” block to flow into the same “Message” block.

unify-conversation-flow

The message block is pretty flexible. It’s not only messages you can share with it since when you click on the “MEDIA” option, but you will also be able to easily upload a file, share a YouTube video or share a GIF or an image.

add-media-to-whatsapp-bot

Of the options available, I chose the 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

11. 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-upClick 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.

That is it!

12. 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 let’s 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 is it.

13. 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 sheet 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 bot-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 bot 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!

14. Set Up Slack Notifications


I have a little bonus up my sleeve!

If you don’t have agents sitting on the Landbot 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 one an existing Slack channel or a specific person who 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!

15. Test Your Bot!


I am only testing my bot 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 user’s final 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

16. 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, Landbot even allows you to build smart NLP bots without coding.


Conclusion


WhatsApp chatbots allow you to deal with incoming messages in real-time which is what makes them so attractive.

Thanks to smart solutions, learning how to create WhatsApp bot doesn’t have to be rocket science nor does it have to involve artificial intelligence to be useful business-wise.

If you are interested in working with Landbot WhatsApp business solution, check out our WhatsApp Solution features or chat with us to get started building and creating WhatsApp chatbots with Landbot.

Jiaqi Pan