How to Build a WhatsApp Chatbot: Best Practice and Step-by-Step
Content

A WhatsApp chatbot lets your business answer customers 24/7, handle FAQs, qualify leads, or collect information before handoff to an agent. Building one with the WhatsApp Business API means following best practice: approved templates for the first message, session messages for the dialogue, and clear handoff rules so customers get help when the chatbot cannot.
This guide gives a step-by-step approach to building a WhatsApp chatbot: what to plan, how templates and flows work, best practice for compliance and handoff, and how a platform like Spoki can help. For chatbot and automation options, see Spoki artificial intelligence, features, and solutions.
Step 1: Define Use Cases and Flows
Before building the chatbot, decide what it should do:
- FAQs: Opening hours, returns, contact details, delivery times. List the top 10–20 questions and the answers. The chatbot can match customer questions (keywords or AI) and reply with templates or session messages.
- Lead qualification: Ask a few questions (e.g. product interest, company size) and then handoff to sales or book a demo. Use templates to start and session messages to branch by reply.
- Order or booking status: If you have an API or webhook to your CRM or e-commerce, the chatbot can look up status and send a template or session message with the result.
Write the flows (what message when, what reply triggers what) and where handoff to a human happens. For use cases and customer support, see the links.
Step 2: Choose Templates for the First Touch
On WhatsApp, the first message to a customer (or the first message after the 24-hour session ends) must be an approved template. So your chatbot needs templates for:
- Welcome or first question: e.g. “Hi {{1}}, how can we help? Reply with a number: 1 = Order status, 2 = Returns, 3 = Speak to an agent.”
- Order status: “Your order {{1}} is {{2}}. Reply for more help.”
- Handoff: “We’re connecting you to an agent. You’ll get a reply shortly.”
Submit templates for approval in Meta Business Manager (or via your BSP). Once approved, your chatbot or platform can send them. A platform like Spoki helps you manage templates and automation so the chatbot uses the right template at the right time. For registration and pricing, see the links.
Step 3: Build the Conversation Logic
Once the customer replies, you’re in the 24-hour session and can send free-form messages. The chatbot logic can:
- Match keywords or intents: If the customer says “order” or “status,” trigger the order-status flow. If they say “agent” or “human,” trigger handoff.
- Branch by reply: If you sent “Reply 1, 2, or 3,” branch on 1, 2, or 3 and send the next message or template accordingly.
- Use AI or NLP: For more natural conversation, use AI or NLP to understand intent and choose the right reply. Spoki offers artificial intelligence options for chatbots that can qualify leads or answer FAQs.
Keep flows simple at first (e.g. 3–5 options, clear handoff), then add complexity. For FAQ and contact, see the links.
Step 4: Define Handoff Rules
Best practice for a WhatsApp chatbot is to handoff to a human when:
- The customer asks for an agent or “human.”
- The chatbot does not understand after one or two tries.
- The topic is sensitive (e.g. complaint, refund) or outside the chatbot’s scope.
- You have a rule (e.g. “always handoff for billing”).
Define these rules in your chatbot logic and notify your support team (e.g. create a ticket or assign to a queue) so the customer gets a reply. The conversation stays in the same WhatsApp thread so the agent has full context. For customer support and solutions, see the links.
Step 5: Test and Go Live
Before going live:
- Test every flow: Send each template, reply with each option, and check that handoff works. Test edge cases (e.g. customer sends “?” or a long message).
- Check compliance: Templates must be approved; opt-in must be in place for marketing. For support, ensure you’re not messaging customers who have not contacted you or opted in where required.
- Monitor and iterate: After launch, track conversation volume, handoff rate, and customer feedback. Adjust flows and templates to reduce handoff where the chatbot can improve and to keep handoff where humans are needed.
Platforms like Spoki provide features for WhatsApp chatbots, templates, and automation so you can build, test, and run your chatbot without coding everything in-house. For a ROI estimate, use the roi-calculator; to see it in action, book a demo.
Best Practice Summary
- Start with a few use cases: Don’t try to cover every conversation on day one. Launch with FAQs or one flow (e.g. order status), then add more. That keeps compliance and handoff manageable.
- Always offer handoff: Make it easy for customers to reach a human (e.g. “Reply 3 for an agent”). Chatbots work best when customers know they can handoff when needed.
- Keep templates compliant: Use only approved templates for the first message and after session expiry. Never send free-form first when the session has ended—WhatsApp can restrict or block your number.
- Measure and iterate: Track conversation volume, handoff rate, and customer feedback. Use the data to improve flows and templates so the chatbot handles more and handoff stays for the right cases. For more on support and automation, see Spoki customer support and features.
Conclusion
Building a WhatsApp chatbot with the WhatsApp Business API follows a clear step-by-step path: define use cases and flows, choose templates for the first touch, build the conversation logic, define handoff rules, and test before going live. Best practice includes compliant templates, clear handoff, and iteration based on data. A platform like Spoki supports chatbot automation, templates, and integrations so you can build and run your WhatsApp chatbot efficiently.
Ready to build your WhatsApp chatbot? Explore Spoki features and artificial intelligence, register, or book a demo to get started.

