Build a WhatsApp Chatbot
WhatsApp Business API
Beyond the Small Shop
So far, we've talked about building chatbots. But a chatbot isn't very useful if it can't talk to people on the platforms they actually use. For millions of businesses, that platform is WhatsApp.
While the standard WhatsApp Business app is great for a single person at a small company, it hits a wall quickly. It's hard to manage conversations with a team, and you can't connect it to more advanced software. When a business needs to handle many conversations at once, or wants to automate its communication, it needs something more powerful. That tool is the WhatsApp Business API.
API stands for Application Programming Interface. Think of it as a set of rules and tools that lets different software programs talk to each other. In this case, it lets your chatbot or business software communicate with customers through WhatsApp.
Unlike a regular app with a user interface, the API is a backend service. It's designed to be integrated into other systems, like a Customer Relationship Management (CRM) platform or a custom-built chatbot. This allows for automation, handling thousands of conversations at once, and letting multiple team members respond to customers from a single WhatsApp number.
Integration with existing customer relationship management (CRM) systems is another notable feature of the WhatsApp Business API.
How Conversations Work
WhatsApp is protective of its users and wants to prevent spam. To do this, the API structures all conversations around a simple rule: businesses can't just message anyone at any time. The rules depend on who starts the conversation.
When a user sends a message to your business, a 24-hour clock starts. During this window, your chatbot or support agent can send free-form messages back and forth with the customer. This is called a "session."
Session Message
noun
Any message sent by a business in reply to a user message within 24 hours. These can be plain text, media, or interactive messages and don't require pre-approval.
But what if you need to contact a customer more than 24 hours after they last messaged you? Or what if you need to initiate the conversation yourself to send a shipping update, an appointment reminder, or a payment confirmation?
For these situations, you must use a Message Template.
Message Template
noun
A pre-approved message format used to start a conversation with a user or to contact them outside the 24-hour session window. These templates can include placeholders for dynamic information like names, order numbers, or dates.
To keep conversations helpful, you can't just send anything in a template. Promotional content is heavily restricted. The primary purpose is for transactional or essential updates. To make these messages more engaging and useful, you can also include interactive elements.
| Interactive Element | Description |
|---|---|
| Quick Reply Buttons | Lets users respond by tapping a button instead of typing. (e.g., "Yes," "No," "Track Order") |
| Call-to-Action Buttons | Lets users visit a website or call a phone number with a single tap. |
| Lists | Presents a menu of up to 10 options for the user to choose from. |
Getting Started
Accessing the API isn't like downloading an app. It's a formal process that involves setting up a WhatsApp Business Account (WABA) within Meta's Business Manager. This is the central hub for managing your business assets, including your phone number and payment methods.
During this setup, your business will undergo a verification process. Meta needs to confirm that your business is legitimate and complies with their policies. This helps maintain the quality of the platform and protects users from scams or unwanted messages.
Once your business is verified and your account is active, you still need to get your message templates approved. Each template you create is submitted to Meta for review to ensure it follows the rules. This review is usually quick, but it's a crucial step before you can start sending outbound notifications.
Rules and Responsibilities
Using the API comes with a few key responsibilities to ensure a good user experience.
First and foremost is user consent. You must get an explicit opt-in from a user before you can send them business-initiated messages on WhatsApp. This consent must be active, meaning the user takes an action like entering their phone number and checking a box to agree to receive messages.
Second, businesses must maintain a high quality rating. WhatsApp monitors user feedback, including blocks and reports. If many users block your number, your quality rating will drop, and your messaging limits may be reduced or even suspended. It's vital to only send messages that are timely, expected, and relevant.
Where possible, customers will always prefer human agents to bots, so WhatsApp made it compulsory to have a Human Escalation pathway.
Finally, remember the human touch. Even when using a chatbot, it's essential to provide a clear and easy way for customers to reach a human agent if the bot can't solve their problem. This ensures that customers don't get stuck in frustrating automated loops.