Building a WhatsApp AI Chatbot for Business

By Darus S Alfatah · 2025-09-11 · Implementasi · 9 menit

Building a WhatsApp AI Chatbot for Business

Author note: Reply fast, then complete. Holding a reply until perfect makes customers think the bot is dead.

Architecture in Three Parts

A WhatsApp bot has a webhook that receives messages, a logic layer that calls the model, and a sender that replies. Keeping these separate makes each part testable, and lets you replace the channel later without rewriting the logic.

Store conversation state per phone number: which menu the customer is in, what information is missing, and whether a human has taken over. Without state, every exchange restarts and the bot feels broken.

Handling Real Messages

Customers write fragments: "how much?", "still available?", or send a sticker. Decide early what you support and what you route to a human. Guessing on ambiguous messages produces confident wrong answers, which is worse than admitting uncertainty.

When a human joins, disable automatic replies for that conversation so the customer does not receive two competing answers.

Quick Replies

Use buttons or numbered options for flows with limited answers: order status, opening hours, payment methods. Choice-based interaction is more accurate than free-text understanding and faster for the customer.

Compliance and Etiquette

Follow the platform's messaging rules, including template requirements for messages sent outside the customer service window. Tell users they are talking to an automated assistant and give them a fast way to reach a person.

Data Handling

Chats contain phone numbers, addresses, and payment details. Store the minimum needed, redact the rest before sending anything to a model, and limit staff access to conversation history.

Frequently Asked Questions

Which provider should I use? The official business API; unofficial libraries risk bans.

How do I test before launch? Run a private number with real staff as customers for a week.

What about voice notes? Transcribe them if the model supports audio, otherwise ask for text.

How do I measure success? Self-service rate, first response time, and escalations.

What is the biggest risk? Answering confidently when the answer is unknown.

Conclusion

A WhatsApp bot is mostly conversation design and data discipline. Get the state machine and escalation right, and the model choice becomes secondary.

Improving Over Time

Review fifty conversations a month and look for repeated failures: the same question answered poorly, or moments where the customer repeated themselves. Those patterns point directly at missing content rather than model limitations.

Update the answer bank and the menu structure accordingly. Small, regular edits keep the bot useful; large rewrites every six months lose the knowledge accumulated in between.

Handling Escalations Well

When handing over, pass context to the human: what the customer asked, what the bot already answered, and any order number collected. Agents who must start from scratch will ask the customer to repeat everything, which is worse than having no bot at all.

Measure escalation rate weekly. A rising rate is an early warning that your content or flows no longer match what customers need.

Launch Checklist

Test with ten real customers, confirm the handover works, verify that opt-out requests are honoured, and check that the bot never sends two replies to one message. Run through the list again after any change to the flows.

Example: reply fast: Reply got it, checking now within a second, then send the full answer once data is available. The user feels served from the start.

Frequently Asked Questions

What do I get from this implementation guide?

Concrete steps to connect an AI API to your system, including example configuration and pitfalls to avoid.

Are there code samples I can use?

Yes, the article includes examples you can adapt to your stack.

How do I handle errors during integration?

Use the API error messages for diagnosis; BankAI docs explain common error codes and fixes.

Sources & References

About the author

Darus S Alfatah — Founder & Writer

Darus S Alfatah is the founder of BankAI. He builds and operates the LLM API gateway that serves Indonesian developers, and writes about LLM integration, gateway architecture, and using AI practically and cost-effectively. Every guide is tested in a real environment — including code, configuration, and token calculations — before it is published, and updated when provider documentation or pricing changes.

Editorial policy

🚀 Ready to Use the All-in-One API Key?

Sign up, top up with QRIS, and start building with ChatGPT, Claude, DeepSeek and every other model through one key.

🔑 SIGN UP NOW · Pricing