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.
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
A customer messages your WhatsApp number.
AI answers from your FAQ text and decides whether a person is needed.
The customer gets the answer, or a message saying someone will follow up.
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
Build your own
Need it to work differently?
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
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?
Where does the FAQ text live?
Can I reply to the customer from the email?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Follow up new leads by email and WhatsApp within minutes
Each new lead gets a personal email and a WhatsApp message within minutes, written around what they asked.
See how it worksGet critical alerts by email and WhatsApp
When one of your systems reports a failure, you get an email and a WhatsApp message, without repeats for the same problem.
See how it worksGet each new Stripe sale by email and WhatsApp
Every completed Stripe checkout sends you an email with the details and a WhatsApp message with the amount.
See how it worksKeep exploring
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.