Skip to content

The moment it happens

Answer WhatsApp customers with AI that remembers the chat

Customers get a sensible answer in seconds that takes their earlier messages into account, and you get an email when someone wants a person.

Runs
The moment it happens
Apps
WhatsApp Business
AI
Yes, uses the built-in AI allowance
Access
whatsapp_business_messaging, whatsapp_business_management

Send this to your assistant

Create a ClickRuntime automation: when someone messages our WhatsApp number, reply using the opening hours, prices and delivery info below, remember each customer's last 10 messages, and email me at owner@example.com if they ask to speak to someone.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A customer writes to a business WhatsApp number at 10 p.m. asking whether the blue jacket comes in a large and when it would arrive. Nobody answers until morning, and by then the person bought elsewhere. Staff who do answer spend the day typing the same replies, and each new message starts from zero because they have to scroll back through the chat to remember what the customer already said.

When a message arrives on your WhatsApp Business number, the automation loads that customer's earlier conversation, asks ClickRuntime's built-in AI to write a reply using it, sends the answer back on WhatsApp, and saves the updated history. If the question is beyond what it should handle, it emails you so a person can take over.

It fits shops, clinics and service providers who get repetitive questions and want fast, context-aware first replies.

What you get out of it

  • Customers get an answer in seconds

    A reply at 10 p.m. keeps a buyer who would otherwise move on to a competitor, so a meaningful share of after-hours enquiries turn into sales or bookings instead of lost chances nobody ever knew about.

  • Memory avoids asking twice

    Because earlier messages are loaded, the reply knows the customer already gave their size or order number. They are not asked again, which feels respectful and shortens conversations that would otherwise drag on for a dozen messages.

  • Staff time goes to harder questions

    Routine questions about hours, sizes or delivery are handled automatically, leaving people free for complaints, custom requests and sales conversations where judgment and empathy genuinely change the outcome for the customer.

  • Escalation by email catches the hard cases

    When a question needs a person, you get an email with the context, so nothing sensitive is left to an automated reply and the customer is not stuck going around in circles with a bot.

  • A consistent voice

    Replies follow the guidance you set, so a customer gets a similar tone whether they write on Monday or on Sunday night, and new staff do not each invent their own wording for the same policy.

How it works

What happens, step by step

  1. When a customer messages your WhatsApp Business number, ClickRuntime picks it up straight away.

  2. It looks up your earlier conversation with that customer, so the reply takes past messages into account.

  3. AI writes a short answer about your business and ClickRuntime sends it back on WhatsApp within seconds.

  4. If the customer asks for a person, or AI can't help, you get an email so you can step in.

Before it runs live

  • Connect WhatsApp Business
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Answer WhatsApp customers with AI that remembers the chatjust nowSucceeded
WhatsApp · Customer chatCustomer: can I still order a cake for Saturday? Northwind Bakery: Yes! Order by 4pm Friday and it'll be ready from 8am Saturday.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other WhatsApp Business steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
ai_auto_reply_to_whatsapp_messages_with_memory.pyexample
from clickruntime import on_event, credentials, http, state, ai, notify

PHONE_NUMBER_ID = "123456789012345"
BUSINESS = "Northwind Bakery. Open 8–18 Mon–Sat. Orders by 4pm for next-day pickup."

@on_event
def handle(event):
    value = event.json["entry"][0]["changes"][0]["value"]
    if "messages" not in value:
        return {"skipped": "status update"}
    msg = value["messages"][0]
    sender, text = msg["from"], msg.get("text", {}).get("body", "")
    history = state.get(f"chat:{sender}") or []
    history.append(f"Customer: {text}")
    out = ai.generate("\n".join(history[-20:]), system=f"You reply to WhatsApp customers for {BUSINESS} Be brief. Set human=true if they ask for a person or you can't help.",
                      json_schema={"type": "object", "properties": {"reply": {"type": "string"}, "human": {"type": "boolean"}}}, max_output_tokens=250).json
    http.post(f"https://graph.facebook.com/v21.0/{PHONE_NUMBER_ID}/messages",
              headers={"Authorization": f"Bearer {credentials.secret('WHATSAPP_TOKEN')}"},
              json={"messaging_product": "whatsapp", "to": sender, "type": "text", "text": {"body": out["reply"]}})
    history.append(f"Us: {out['reply']}")
    state.set(f"chat:{sender}", history[-20:])
    if out["human"]:
        notify.email_me(f"WhatsApp: +{sender} wants a person", "\n".join(history[-6:]))
    return {"replied": True, "escalated": out["human"]}

FAQ

Common questions

Does the AI reply count against WhatsApp's 24-hour window?
WhatsApp allows free-form replies within 24 hours of the customer's last message. Because this replies to an incoming message, it falls inside that window. Outside it, only pre-approved message templates can be sent to the customer.
Can I stop the AI from answering certain topics?
Yes. You can tell your AI assistant which topics must go to a person, such as refunds, medical questions or complaints, and the automation sends you an email instead of replying on those, leaving the customer to wait for you.
How much of the conversation does it remember?
It stores the recent history per customer phone number and loads it for each new message. You can set how many messages to keep, and old history can be cleared so it does not grow without limit or carry stale details.
What permissions does it need?
whatsapp_business_messaging, whatsapp_business_management. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Answer WhatsApp customers with AI that remembers the chat” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.