Scale Up your Business with the Planet’s most active Personal Messaging Platform — Whatsapp Business API

Payoda Technology Inc
8 min readDec 28, 2020

--

Whatsapp, probably the most familiar name among us. Almost 2 Billion people have at least used this application, once in their lifetime. It has 80% active users, reported by Facebook, means 1.6 Billion people are using it daily in their day to day routine life. It has most probably a higher penetration rate among top smartphone applications, not only among educated urbanites, even among the most common people in emerging markets like India.

There are way more personal messaging applications available in the market, but WhatsApp is unarguably the top personal messaging service provider on the Planet, because of its standards in aesthetic and simple app design, principles in user’s privacy, quality of service, and also because of forwarded messages from our favorite Mamas and Chithis. (uncles and aunts). With such a huge under-tapped market of people who feel personalized, Whatsapp could be used effectively for our Business Development, Quality & Personalised Customer Service, Product endorsement at a lower cost.

Let’s see how we can do it.

Whatsapp Business Can be broadly divided into two categories:

1. Whatsapp Business App

2. Whatsapp Business API

Whatsapp Business App:

Whatsapp Business App is a free application available in the App Store targeted for Small Businesses in Emerging Markets. Business owners can create their respective business profiles and are able to communicate with their customers manually, just like any other WhatsApp client. There is nothing much we need to know in this category since it is handled manually and used by small business owners.

Whatsapp Business API:

Whatsapp Business API is a product provided by Facebook Inc which could be taken advantage of by Medium Businesses and Large Enterprises. It could be used as a Personalised Customer Service Provider, Bot Responses, Upsell & Product Endorsement Tool, as well as an e-commerce app also! with n number of other usages as well. Before getting into the technical aspects of Whatsapp Business API, let us understand how and when we can use Whatsapp Business API and its limitations.

Whatsapp Business API is completely managed under Facebook for Business, a division of Facebook Ad. We need to register our Business with Facebook. (refer to the link below)

You must have the following requirements:

1) A Domain Name

2) An Email Address

3) A Phone Number

4) Your Business-related Details like Your Domain and Business Model

Once you fill out those forms, You will be sending it for approval by the Facebook Team. Once approved, You are eligible to use WhatsApp Business API. You will be receiving a Facebook Business Manager ID and with that, you can log in to Facebook Business Manager Dashboard, Generate your API Keys, etc.., for further development.

The World is not an Ideal Place:

Since Facebook has higher standards for WhatsApp and its Quality of Service. There are certain limitations that we need to consider as follows, (we will be looking into this in detail)

1. WhatsApp Cannot be used for direct marketing (in a way) to avoid spamming and degrading the quality of service.

2. Messaging Templates / Placeholder Templates needed to be approved by the Facebook Team.

3. 15 messages limit per second at maximum

4. User’s permission/consent is needed to enroll in WhatsApp Business API or the User needs to start the conversation first.

5. There is a 24-hour window limit in Session Messaging.

There are two possible ways of communicating with Users in WhatsApp.

1. Session Messaging

2. Template Messaging

Session Messaging — a way of communicating with the user in Whatsapp. If the user approves for WhatsApp Business API or sends the First Message, He could be considered as ‘our Contact List’. The message he sends could be replied back from our Servers in an automated way (using Bots for example) in a 24-hour window limit. The messages sent in this way are NEED NOT BE APPROVED by Facebook. The possibilities are,

1) we could send back an automated predefined reply

2) we could connect to our bots and send any details (if any)

3) we could send product recommendations or such services

4) we could send them links, images, videos, documents of any kind

5) we could take orders from them, registers their address, and could process an order

The limitations are our creativity

Template Messaging — if the Server (us) wants to send any message to our contact list after the 24-hour limit, we could only send a template message to the user. The Template message could be a placeholder string that can be filled dynamically or a predefined message. Either way, the messages NEEDED TO BE APPROVED by Facebook. Facebook does this, to avoid spamming and degradation of service. Once the user replies back, Session Messaging communication could be established. The Session Messaging would be extended or reset to the next 24 hours, whenever the user replies back. That is, each and every reply from the User would extend the 24-hour window, This setup in place, in order to force the Businesses to provide Quality Customer Service, as WhatsApp is considered to be personal and most effective/active by the user base themselves.

Everything comes at a Price:

Session Messaging is COMPLETELY FREE. WhatsApp bills for Template Messaging and the Price varies according to Country, Region, etc. (refer to the bottom link for pricing information)

Since WhatsApp cares about user’s privacy the most, End to End Encryption is applicable by default. The conversations are highly encrypted in such a way that even WhatsApp company couldn’t decrypt in the middle.

Because of E2E, we cannot consume WhatsApp Business API’s API :D like a typical Public REST API. We need to pay some price for Initial Setup in our Server or if We opt for Third-Party SaaS styled Services. It is to be noted that WhatsApp has some approved Business partners who provide WhatsApp as a Service. We will discuss the infra needs, other options, and the price associated with it in detail.

To Consume WhatsApp Business API or Provide WhatsApp as an integrated Service in our Solutions, We either need to set up our Own Infrastructure or Register with a WhatsApp as a Service from Third-Party Vendors (recommended). The Third-Party Vendors are highly recommended by WhatsApp itself for Medium Scale Businesses unless we have capability and reasons to establish our own Infra Solution for Whatsapp.

Here comes a twist:

The Deployment of our own WhatsApp Infra is a little bit complicated (discussed below), So Whatsapp Recommends Business Partners. (link below) Partners have different solutions and areas of concentration. Some Partners from India are FreshDesk, ZenDesk, Kaleyra, etc. Each partner has its unique Solutions, Supports, and Pricing Models. Some may offer integrated Customer Care Solutions, Some may offer Just API endpoints to integrate with our Backend Services/Bots, etc. So, if we are considering Third-Party Solutions, Price = Third-Party Price + WhatsApp Price. This is applicable for Session Management Also. The Price cannot be detailed here, because of different packages, various addon services had to be considered. The link to Business Partner Search is given below.

But mostly, If we opt for Third-Party Service, we will be given a Dashboard, where we can log in, Configure API Keys, maintain Contacts, Create Messaging Templates, and will be sent for Approval. Will be provided with Forms to configure Webhook URLs, using which we can integrate with our Backend Services. (refer below)

So why don’t we go for our Own Infrastructure Solution for WhatsApp instead of Third-Party — A Developer’s Guide

WhatsApp is offering a Completely different Solution unlike a Typical Messenger application like Messenger or Telegram. In Order to set up WhatsApp Service in our own environment, We need to run a Server Instance. The minimal requirements are given in their (Facebook) words,

“If you happen to be using a single server, what we recommend is a server with at least 250 GB SSD, 16 GB RAM, and 4 core CPU. HDD is not recommended as the I / O speeds tend to become bottlenecks under load.” — Official Docs

So in order to set up WhatsApp Business API, you need to establish a Node in your Server Instance. The Node could be a Server Application that needs to be in constant sync with WhatsApp Server maintaining a long-lived TCP connection. The Node should have three main components:

1. Core App

2. Web App

3. Database (MySQL or PostgreSQL are recommended)

The Architecture of WhatsApp Business API Server:

Core App:

The Core App is essentially the main daemon process that runs the WhatsApp Client in our Server. Our Server is a WhatsApp Client (a node) in a cluster of decentralized WhatsApp Nodes. The Core App is responsible to maintain the Encrypted Keys, Contacts, Integration with Whatsapp’s Public APIs (given below) for messaging (sending and receiving), etc. The Core App is also responsible for Integration with the Database and Integration with our Backend Services.

Web App:

The Web App is the interface between the Core App and our Backend Services. Usually used to configure API Keys, Sending Messages, Creating Message Templates, Send it to WhatsApp for Approval, Configuration of settings/Keys for integrating with our Backend Services for Bot responses.

The important information here to be considered is that, for One Registered Number, We need to establish once Instance of WhatsApp Core APP. For multiple phone numbers, we need to establish those many instances.

Some available client endpoints (links are given below)

Contacts: Check your customer base numbers

Groups: Creates and manages groups

Health: Check the health/status of your Client (CoreApp and WebApp)

Media : Media Management (photos / videos / documents)

Messages: Detailed Information is given below

Registration: Registering your WhatsApp account

Settings: Application Settings

Stats: Statistics

Support: Direct support endpoint on client

Users : Client tokens / client management

Messages:

Messaging is Probably the widely used API in WhatsApp. We can send,

* Audio

* Video

* Documents

* Text

* HSM — Predefined Messaging Templates That could be populated Dynamically with some Placeholder variables.

WebHook:

Webhooks are usually Http Callback API, called/triggered and is sent, configured on WhatsApp Client. NOTHING IS DONE IN WHATSAPP SERVERS. The Architecture is decentralized and Messages are sent/received from the Clients (Nodes of WhatsApp Cluster) Directly. Essentially webhooks are triggered by the client. Our Backend Service would receive A JSON with Media/Text which could be analyzed from our bots

and send messages to users

References:

https://www.facebook.com/business/m/whatsapp/business-api

https://www.facebook.com/business/m/whatsapp/business-api

https://developers.facebook.com/docs/whatsapp

https://www.freshworks.com/live-chat-software/integrations/whatsapp/?utm_source=fb_dir

https://www.kaleyra.com/

https://netcoresmartech.com/channels/whatsapp-notifications

https://www.youtube.com/watch?v=ANwhFkqBtog&list=PLru3XF1u4sKJcR1N3_w5MUl4HpZkCTfli

https://www.twilio.com/whatsapp

https://www.facebook.com/business/help/2087193751603668?id=2129163877102343

https://developers.facebook.com/docs/whatsapp/api/reference

Author: Sreenivasa Rajiv R

--

--

Payoda Technology Inc

Your Digital Transformation partner. We are here to share knowledge on varied technologies, updates; and to stay in touch with the tech-space.