How WhatsApp bot works - part 1

In this series of short posts I want to lay out the foundations of bot creation, so you’ll understand how WhatsApp bot work.

Every bot is being created using some third party framework that has the right to officially use WhatsApp business API, like Twilio for example.
The reason that a third party is needed is due to the fact that WhatsApp (owned by Facebook), doesn’t allow direct interaction with its API. The interaction can only be done through a third party.

This framework allows the bot to operate on WhatsApp business network. The phone number of the bot’s creator is connected to WhatsApp business network via this framework. Usually the phone number will be a virtual phone number purchased from the third party’s pool of virtual phone numbers that are capable of sending WhatsApp messages (and SMS messages or voice messages).

After the bot has been created in the third party’s framework, it receives incoming messages or API calls, and a dialog between the bot and some other user’s WhatsApp account is initiated. The actions and behaviors of the bot during the dialog with the user, are called ‘flow’.

During the bot’s flow it collects information from the user, e.g. email, name, interest, AI intents of text that the user write to it, etc…

During the bot’s flow the bot is using different functionality of the third party’s framework in the form of blocks or actions, connected to each other according to the direction of the flow.

During the flow, the bot is also calling different APIs to get or do things that are needed in a specific business process. These API calls can be performed inside the bot’s flow, i.e. by using REST API or JSON API built-in blocks, or by calling to another process (sending a webhook) that will do more things “outside” of the bot’s flow, e.g. in Zapier or Integromat or Google Cloud Function or AWS Lambda Function, Data Base, etc…

In the next part I’ll elaborate more on how WhatsApp bot works.

Scroll to Top