Table of Contents

Build a WhatsApp Bot - Best Practices and User guide

Rafaela Basso Updated by Rafaela Basso

How to Create a WhatsApp bot

  1. To create a WhatsApp bot click on the "Build a chatbot" option of your dashboard and select WhatsApp:

  1. Once you select the Whatsapp bot will see that you can start the bot from scratch (a new bot) or you can select a WhatsApp bot Template.

Once you have finished building your bot you can test it for free on your mobile device using the WhatsApp testing channel.
For more information on how to link your Whatsapp bot to a channel, please check this article πŸš€

Best Practices to build WhatsApp bots

Keyword Options block - Assign keywords to buttons

Instead of using the Buttons block in your WhatsApp bots, we advise you to use the Keyword Options block - which was built specifically for WhatsApp.

If you use the Buttons block in your WhatsApp bot, you have seen that the "buttons" are displayed as a numbered list of choices, so the valid answer to this type of question is typing the number corresponding to your choice.

Moreover, having a text input in WhatsApp makes you automatically want to write text and not numbers!

With the Keyword Options block, you can assign multiple keywords to the button, so that the user can write any of the keywords or the corresponding number of the chosen option:

For more information about how the Keyword Options block works, please refer to this article.

Message sequence

When using Messages, the best practice is to:

  1. add Text and Media in independent blocks:
  1. As a rule of thumb DO NOT have more than 2 message blocks without user input.

Capture the first user's input and use it to redirect the flow

Unlike Web bots, in WhatsApp, it is not necessary to start the flow with the Welcome Message block.

You can directly capture the first user's message and use it within your bot, or even redirect the flow depending on what the user has texted!

To capture the first user's input, you should delete the Welcome Message block and start your flow with Set a variable block, where you will create a variable @init (String format) with the value of ${body} :

For more information about capturing the first user's input, please refer to this article.

Direct a user through a different bot flow on their Second Visit

If you capture the first user's input, as explained above, you can also use it to direct a user through a different bot flow on their second visit!

All you need to do is create a variable using Set a variable block at the end of your first flow, which will indicate that the user has gone through this path. Then at the beginning of the flow, we'll use this variable in the Conditions block to redirect the users on their second visit:

For a detailed explanation, please refer to this article.

Global Keywords

As WhatsApp has a fixed text input field, the users can type anything at any point in the bot flow.

To take advantage of that, you can use the Global Keywords block, and assign keywords that will be captured and triggered at any point in the bot flow.

For example, if the user type "Agent" at any point in the flow, you can interrupt the flow and direct them to a flow containing a Human Takeover block.

Please check this article for more information about how to use this feature.

Types of Content Supported:

You can send different types of content to your users, but please keep in mind that due to Whatsapp's user interface, not all features are displayed as they are in Web bots.

Please see this article to check how the kind of content or media you will send/receive is supported by our WhatsApp bots.

Features Compatibility with Whatsapp

Please keep in mind that some of the features available for Web bots are not completely compatible with Whatsapp bots - even if it possible to find them in your Whatsapp bot builder.

So make sure to check the compatibility in the articles specific for each feature you will use in your Whatsapp bot πŸ˜‰

For a full list of compatibility of our features with Whatsapp, please check this article 😎 πŸš€

Session and variables

If you are not familiar with the concept of variables, please check this article.
  • A variable can be set.
  • A variable's value can be changed within the flow or at the conversation in the Chats section (by your Human Chat Agents).
  • A variable cannot be null/undefined.
  • A variable cannot be unset.
  • A value remains in the Whatsapp session, and will be overwritten if the user answers the same question with a different answer.
  • Whatsapp automatically captures the name and phone number of the users, which are saved in variables by default. You can check or reuse these values at any time, using the variables @name and @phone.

Loops are banned

Loops without user input, cannot be used, and the bot builder does not allow its creation.

Loops are only allowed when there is a user input as part of the loop.

Interacting with Users

Contact users within 24h from their last contact with your bot

Once users have started a conversation with your Whatsapp bot, you can contact them through the Chats section without any limitation, within a 24h window - counted from the last message sent by the user.

But due to Whatsapp's policies to prevent Spamming users, after these 24h, it will be necessary to get the user's authorization to be contacted proactively (Opt-in).

If these 24h have passed, your messages in the Chats section will not be delivered.

If the users have Opted in, you can contact them proactively using templates pre-approved by Whatsapp (HSM Templates).

Please check this article to learn more about the Opt-in, and this article to learn more about the HSM Templates and how to request them.

Make sure to get the User's authorization (Opt-in) to be contacted

After the 24h window from the first contact is passed, it is only possible to contact proactively the users that have accepted to be contacted by you.

That means, the clients that have made the Opt-in.

So if the users have made the Opt-in, you can send Templates pre-approved by Whatsapp (HSM Templates).

Please check this article to learn more about the Opt-in.

Reach out to users using Templates and Campaigns

To contact proactively users that have made the Opt-in, you must restart the conversation by sending HSM Templates, which must be approved by Whatsapp.

You can send HSM Templates individually within a conversation in the Chats section, or for multiple users at the Campaigns section.

Please check this article to learn more about the HSM Templates and how to request them.

Use Call-to-action buttons in your HSM Templates

Ceate an interactive template to allow reach out proactively to your users on Whatsapp, while at the same time allowing them to click a button to call you or redirect them to your Website.

Please check this article to learn more about the HSM Templates and how to add a call to action to it

Just Human Takeover?

If you just want to use your Whatsapp number to have your Human Chat Agents answering chats, you can create a bot specific for that, with a simple flow leading to the Human Takeover block.

Please check this article to learn more about the Human Takeover block, and this article to learn more about the Chats section.

One bot at a time (Parent bot x New Parent Bot x Campaign bots)

You must link a "main bot" to your Whatsapp number, which we call a Parent bot.

New Parent Bot:

If you change the Parent bot, the flow of the parent bot will not break.

The Parent bot will end first, and then the new Parent bot will start.

Bot Linked to Opt-in:

If you connect a bot to a Snippet for the Opt in, it will interrupt the flow of the Parent Bot.

Bot Linked to Opt-in or Campaign:

If you launch a Campaign with a bot, it will interrupt the flow of the Parent Bot.

Please check this article to learn more about the Parent Bot, and this article to learn more about Campaigns.

Add a Click-to-WhatsApp to your Web bot

It is possible to add an option to your Web bot allowing users to send a message to your Whatsapp with a click 😎

Check out this article to see the instructions on how to do this πŸš€

Analyze Metrics and Data

Check the Metrics section

The data belongs to the same WhatsApp Channel (each number), not the bot.

  1. The best practice to manage all the data related to a WhatsApp number is to use the Metrics section of your Landbot Account.
    Choose the Channel of the WhatsApp number you want to check the data from, and see all the data related to that number.
  2. If you want to see the data specific from one bot that is active in a WhatsApp number, you can also check the Analyze Section of that bot, where you will be able to check the Metrics and the Flow Analytics sections.

    But please keep in mind that this section will not show the information saved in the channel or collected by other bots under the same WhatsApp number. That's why in the Analyze > Users section of the bot the data will not be shown, it must be consulted from the Metrics section of your account.

    In case you have used the Custom Goals feature, the Goals metrics are available under theΒ AnalyzeΒ >Β MetricsΒ section of your bot.

For more information on how to link your Whatsapp bot to a channel, please check this article πŸš€

Whatsapp Testing

After you have created a Whatsapp bot, you can link it to a Whatsapp Channel to have it live.

If you want to test the bot before having the official Whatsapp integration, you can link it to a Whatsapp Testing Channel, and try it out in your own Whatsapp number.

Whatsapp Pro or Whatsapp Business

If you already have the Whatsapp Official integration, with your number approved, you can link the bot to your Whatsapp Pro or Business channel.

How did we do?

WhatsApp bots - Feature Compatibility Guide

Contact