Skip to content

The moment it happens

Answer customers on WhatsApp and email you what the bot can't

Customers get an instant answer on WhatsApp, and anything the bot can't handle is emailed to you with the conversation.

Runs
The moment it happens
Apps
Gmail, WhatsApp Business
AI
Yes, uses the built-in AI allowance
Access
WhatsApp messaging; Gmail send

Send this to your assistant

Create a ClickRuntime automation: when a customer messages my WhatsApp number, answer from my FAQ text; if you can't answer or they ask for a person, tell them someone will follow up and email me the question from Gmail.

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 small online business can't staff WhatsApp all day, but customers expect a reply in minutes. Most questions are routine, a few need a person, and right now both wait the same amount of time.

Letting a bot answer the routine questions straight away, and emailing you only the ones that need a person, gives customers fast answers and puts the tricky questions in the inbox you already work from.

What you get out of it

  • Fast answers for routine questions

    Opening hours, delivery times and returns are answered in seconds.

  • Hard questions reach a person

    Anything the bot isn't sure about comes to your inbox with the customer's number and message.

  • Customers know what's happening

    When a question is escalated, the customer is told someone will follow up.

  • Answers you control

    The bot uses your FAQ text, which you can edit at any time.

How it works

What happens, step by step

  1. A customer messages your WhatsApp number.

  2. AI answers from your FAQ text and decides whether a person is needed.

  3. The customer gets the answer, or a message saying someone will follow up.

  4. Escalated questions are emailed to you from Gmail with the customer's number and message.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect WhatsApp Business
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Answer customers on WhatsApp and email you what the bot can'tjust nowSucceeded
Email · WhatsApp question from +447700900789My Northwind order arrived damaged and I'd like a replacement, not a refund.

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 Gmail and 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.
whatsapp_customer_service_bot_with_email_escalation.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import base64
from clickruntime import on_event, credentials, http, ai

FAQ = "Open 9-5 Mon-Fri. UK delivery 2-3 days, free over £50. Returns within 30 days."
ME_EMAIL = "me@example.com"
SCHEMA = {"type": "object", "properties": {"reply": {"type": "string"}, "escalate": {"type": "boolean"}}, "required": ["reply", "escalate"]}
WA = "https://graph.facebook.com/v20.0/your-phone-number-id/messages"

def wa(to, text):
    http.post(WA, headers={"Authorization": f"Bearer {credentials.secret('WHATSAPP_TOKEN')}"},
              json={"messaging_product": "whatsapp", "to": to, "type": "text", "text": {"body": text}}).raise_for_status()
def incoming(event):
    changes = [c for e in (event.json or {}).get("entry", []) for c in e.get("changes", [])]
    return [(m["from"], m["text"]["body"]) for c in changes for m in c["value"].get("messages", []) if m.get("type") == "text"]
gmail = lambda: build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users()

def send_email(to, subject, text):
    raw = base64.urlsafe_b64encode(f"To: {to}\r\nSubject: {subject}\r\n\r\n{text}".encode()).decode()
    gmail().messages().send(userId="me", body={"raw": raw}).execute()

@on_event
def handle(event):
    for phone, text in incoming(event):
        r = ai.generate(text[:1500], json_schema=SCHEMA, max_output_tokens=200,
                        system=f"Answer from these facts only: {FAQ} Set escalate if unsure, a complaint, or they ask for a person.").json
        if r["escalate"]:
            wa(phone, "Thanks, I've passed this to the team and someone will get back to you shortly.")
            send_email(ME_EMAIL, f"WhatsApp question from +{phone}", text)
        else:
            wa(phone, r["reply"])
    return {"ok": True}

FAQ

Common questions

When does it escalate?
When the answer isn't in your FAQ, when the customer asks for a person, or for complaints and refunds if you choose.
Where does the FAQ text live?
In the automation's settings, as plain text you can edit in your ClickRuntime dashboard.
Can I reply to the customer from the email?
The email includes their number so you can reply on WhatsApp. Replies to the email itself go to your inbox, not to WhatsApp.
What permissions does it need?
WhatsApp messaging; Gmail send. 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 customers on WhatsApp and email you what the bot can't” from your assistant

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