The moment it happens
Answer WhatsApp questions from your Google Drive documents
Customers ask questions on WhatsApp and get answers drawn from the FAQ and policy documents in your Drive folder.
- Runs
- The moment it happens
- Apps
- Google Drive, WhatsApp Business
- AI
- Yes, uses the built-in AI allowance
- Access
- WhatsApp messaging; Drive read
Send this to your assistant
Create a ClickRuntime automation: when a customer messages my WhatsApp number, answer from the Google Docs in my Customer FAQ folder in Drive, refreshing the document text once a day.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Many small businesses already have their policies, prices and FAQs written up in Google Docs. Customers ask about the same things on WhatsApp, and someone copies answers from those docs by hand.
Answering straight from the documents in a Drive folder means the bot always says what your docs say, and updating an answer is just editing the doc you already maintain.
What you get out of it
Answers from your own docs
The bot repeats your policies, not guesses.
Update by editing a doc
Change a Google Doc and the bot uses the new text within a day.
Fast replies
Customers get answers in seconds, at any hour.
Light on resources
Document text is cached once a day instead of read on every message.
How it works
What happens, step by step
A customer messages your WhatsApp number.
The text of your Drive FAQ documents is loaded from a copy refreshed once a day.
AI writes a short answer using only those documents, or says the team will follow up.
The answer is sent back on WhatsApp.
Before it runs live
- Connect Google Drive
- 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 Google Drive 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 time
from clickruntime import on_event, credentials, http, state, ai
FOLDER_ID = "your-folder-id"
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"]
drive = lambda: build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
def docs_text():
cache = state.get("docs") or {}
if time.time() - cache.get("at", 0) > 86400:
files = drive().files().list(q=f"'{FOLDER_ID}' in parents and mimeType='application/vnd.google-apps.document'").execute()["files"]
text = "\n\n".join(drive().files().export(fileId=f["id"], mimeType="text/plain").execute().decode()[:4000] for f in files)
cache = {"at": time.time(), "text": text[:20000]}
state.set("docs", cache)
return cache["text"]
@on_event
def handle(event):
for phone, text in incoming(event):
answer = ai.generate(text[:1000], max_output_tokens=200,
system=f"Answer briefly from these documents only. If not covered, say the team will follow up.\n{docs_text()}").text
wa(phone, answer.strip())
return {"ok": True}FAQ
Common questions
Which documents does it read?
How quickly do edits show up?
What if the docs don't cover a question?
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
Save photos, receipts and voice notes from WhatsApp to Drive
Anything you send to your WhatsApp business number is filed in Google Drive, receipts get their details pulled out, and you get a confirmation.
See how it worksSend finished files from Drive to people on WhatsApp
When a file named with a phone number lands in your Drive Outbox folder, it's sent to that person on WhatsApp and moved to Sent.
See how it worksGet error alerts with a plain-English explanation
When one of your jobs or systems fails, #ops gets the error and a one-line guess at the cause, without the same error twice in an hour.
See how it worksKeep exploring
Set up “Answer WhatsApp questions from your Google Drive documents” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.