DEV Community

Cover image for How to build a 24/7 WhatsApp AI customer service agent with Zernio
Darya Nazarava
Darya Nazarava

Posted on

How to build a 24/7 WhatsApp AI customer service agent with Zernio

What we're building

A workflow that listens for inbound WhatsApp messages, checks whether the person is asking for a human, and if not, sends the message to an AI model along with the conversation history, then replies automatically.

Why you need it

If you've ever tried to answer customer messages on WhatsApp yourself outside business hours, you know the problem: people text whenever, and a slow reply loses the sale or the prospect conversation.

The usual fix is n8n plus a database plus a webhook server, which is a lot of setup for "answer common questions and escalate the rest”, and sometimes might grow very expensive.

Zernio’s WhatsApp API support and visual workflow builder do the trigger, the AI call, the memory, and the reply, all inside the same platform your WhatsApp number already lives in.

What you need

  • A Zernio account - free to start at zernio.com
  • A WhatsApp Business number
  • An API key from an AI provider: Anthropic, OpenAI, Gemini, Mistral, or Grok

How to build it

1. Get your WhatsApp number connected

The workflow triggers whenever someone texts your WhatsApp number, so this step has to be done before anything else works.

In Zernio, go to the phone number section. You've got two options: Get a number (fastest, good if you don't have one yet), or Use my own number (if you already have one).

purchase whatsapp number in zernio

Zernio provisions the number in more than 50 countries, verifies it, and connects it for messaging and calling (for some countries you can only take calls from users, for others - make calls as well).

2. Connect your AI provider

Go to Settings → AI providers. Pick one (Anthropic, OpenAI, Gemini, Mistral, or Grok) and paste in your API key.

connect ai provider to your agent

Note: For a customer support agent, a mid-tier model (like Sonnet, if you're using Anthropic) is the sweet spot. It's noticeably better than the cheapest tier at holding context across a conversation, and a lot cheaper than the top-tier model, which is overkill for "answer from a knowledge block."

3. Proceed with the workflow builder

Zernio allows you to set up workflow automation two ways:

  • using a visual node-builder

  • prompting your AI agent to build it for you (you can connect your AI assistant of choice, like Claude or ChatGPT to the full Zernio API using the MCP)

Whether you build it with the agent or by hand in the visual editor, the logic looks like this:

trigger ─▶ add_tag ─▶ condition(route) ─default─▶ ai(agent) ─success─▶ set_variable(remember) ─▶ send_message ─▶ wait_for_reply ─reply─▶ condition(route)  (loop)
                            │ wants_human─▶ handoff               │ error─▶ handoff                                                      └────timeout─▶ end
Enter fullscreen mode Exit fullscreen mode

Where:

  1. Trigger (inbound message)

  2. Add tag to contact (tag the contact once (e.g. whatsapp-ai-lead) so leads are findable. Put it before the routing/AI so it fires a single time (the loop re-enters at route, not tag).)

  3. Condition (Check each inbound message for a human request (operator: matches, a regex like (?i)(human|real person|representative)) → handoff; the 'default' handle flows to the AI. If the rule never matches it safely falls through to the agent.)

→ YES: Handoff to human (notification inside Zernio)
→ NO: AI node

  • on error: Handoff to human
  • on success: Set_variable (remember). The AI node has no built-in conversation history (it only sees systemPrompt + userPromptTemplate per call). Without memory it re-greets and re-asks every message. So append each turn to a history variable (value: "{{history}}\nThem: {{lastMessage}}\nYou: {{aiReply}}") and put {{history}} back in userPromptTemplate. Now the agent has real multi-turn context.)
  1. Reply (text message, AI output) → Wait for reply (1,440 min / 24 hr timeout) → loops back to AI node if they reply → ends if they don't

whatsapp agent created with Zernio workflow

4. Write the system prompt

This is the part that actually determines whether the agent is useful. This is the prompt that you should pass to your AI agent so it can read the incoming message and draft the answer to that question based on the information you provide.

For example, if you’re building an assistant that should reply to the messages about your business, then you should add the following information into the prompt:

  • Role: [who is this agent — e.g. "customer support agent for {business name}"]
  • What you do: [answer questions, take basic bookings, etc.]
  • Knowledge: [paste your actual hours, pricing, policies, FAQs, links here]
  • Style: [how should it sound: formal, casual, brief, etc.]
  • Rules: [hard constraints: never quote a price not in Knowledge, etc.]
  • Escalation: [when should it hand off to a human instead of answering]

6. Test it

Save the workflow, activate it, and text the number from your phone. Ask something that requires the Knowledge section to answer correctly, not just something the model could guess.

A good test: add one specific, made-up-sounding fact to Knowledge (a policy detail, a name, whatever), then ask about it over WhatsApp. If the reply gets it right, the agent is actually reading the knowledge block instead of hallucinating around it.

7. Extend it with webhooks

Once the base agent works, the workflow's HTTP request node lets you call any external API, calendar booking systems, order lookups, whatever your use case needs. This turns a "answer questions" agent into a booking agent or an order-status agent without leaving the same workflow.

Three tips for making it feel less robotic

  1. Write the prompt like you're onboarding a new hire, not like you're filling out a form. Specificity in Knowledge and Rules is what separates a good agent from a generic one.
  2. Use the webhook node for anything Zernio doesn't handle natively, like calendar availability checks.
  3. Add a small delay before the reply. Instant replies feel like a bot. A few seconds of "typing" time feels human.

Top comments (0)