WhatsApp Business API Integration — Things to remember.

Let's start by understanding the differences between WhatsApp's offerings. Facebook has three primary WhatsApp based products.

WhatsApp

WhatsApp for Business

WhatsApp Business API

WhatsApp is the commonly used app for personal use which we all know. Whereas, WhatsApp for business is for small businesses to interact with their customers. WhatsApp for business offers basic feature set where user can set up their product catalogue and let other users view and place orders. There are other small scale features such as tagging customers etc. More details can be found on their website here.

However, the point to note here is that WhatsApp for business does not offer features which can handle complex conversations with the customers in an automated or an intelligent manner. These may be required for large scale enterprises which are interested in providing service to their customers through WhatsApp. The offering which is better suited for such requirement is the WhatsApp business API.

As the name suggests, WhatsApp business API offers functionality to automate conversations with end customers. We can build chat bot like functionality and integrate with backend systems to provide the necessary context to the chat bot to make conversations more meaningful.

This article tries to outline some points to remember before getting started with WhatsApp business API

WhatsApp Requires Infra

Though the name says API, what you get is not a traditional REST API to interact with WhatsApp servers. WhatsApp requires you to set up and run a Business API client on your network (cloud or on-prem). The steps required are outlined in their getting started guide. The reason for such a setup is their end-end encryption policy. Messages sent to end customers will be encrypted in the client application in your network before even reaching WhatsApp servers.

If you don’t want to maintain and manage the infra necessary for this, you can choose to go with messaging providers such as Twilio, MessageBird etc, which offer WhatsApp integration as a service. In addition, they also provide features like flow builder where you can visually design the conversation with the end user.

Phone Number must be unused

The phone number which you will use to register the business account should not have WhatsApp installed either currently or previously.

Template Registration

Before getting into template registration, let us understand the types of messages that can be sent using WhatsApp. So, there are two types of messages that can be sent, template messages and session messages.

To control spamming, WhatsApp requires you to register the message that you would like to send it to an end user in advance in the form of a template. Messages which are based on the template can be sent to any customer any number of times. These are template-based messages. It is required that WhatsApp approves the templates before you can use them. Generally, an approval can take anywhere between few minutes to an entire day.

Session messages on the other hand are messages that can be composed and sent on the fly. However, you can send such messages only within 24 hours after the time you have received the last response from the end user.

In short, you can send any message you want to the end user for 24 hours after the user replies to you. But, if you want to initiate a conversation, the first message that you would like to send will have to be registered as a template on the WhatsApp Business API portal.

E-Commerce on WhatsApp

At the moment, WhatsApp/Facebook does not allow you to conduct business on WhatsApp. The primary intention is to use WhatsApp as a medium for delivering notifications such as order delivery updates, reservation updates etc.

If you try to register a template which seems like you are trying to conduct business on WhatsApp, it will get rejected during the approval process.

Order of messages sent vs received

The API is asynchronous. When you try to send a message using API, your request will be registered and you will be provided a message id. WhatsApp will asynchronously deliver the message. If you have a requirement to send multiple messages at once to the user, please bear in mind that there is no guarantee offered by WhatsApp that the order of the messages will be preserved.

WhatsApp lets you include a call back URL while sending messages which will be called at certain events to notify the system. Sample events such as sent, delivered, read. In case the order of messages being delivered together is important, a solution can be is to maintain a staging data store holding all the messages to be sent together identified as a batch. Then use the callbacks to maintain/update the status of already sent messages and send the subsequent messages.

Did you find this article valuable?

Support Pavan Andhukuri's blog by becoming a sponsor. Any amount is appreciated!