Every 10 minutes
Send 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.
- Runs
- Every 10 minutes
- Apps
- Google Drive, WhatsApp Business
- AI
- Not needed
- Access
- Drive read+write; WhatsApp messaging
Send this to your assistant
Create a ClickRuntime automation: every 10 minutes, check my Drive Outbox folder for new files, send each one on WhatsApp to the phone number at the start of its name, then move it to the Sent folder.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Labs, print shops, photographers and accountants all produce files that need to reach a specific customer: a result, a proof, a set of photos, a tax return. Emailing each one means finding the address, attaching the file and hoping it isn't too big.
Dropping the finished file into a Drive folder, named with the customer's number, and having it delivered on WhatsApp gets it to their phone in minutes, with the Sent folder as a record of what went out.
What you get out of it
Delivered to their phone
Customers get files on WhatsApp, which they check far more than email.
Nothing to attach
Saving the file in the folder is the only step.
A record of what went out
Sent files are moved to a Sent folder.
Works from any device
Save from your computer, scanner or phone; if it lands in the folder, it's sent.
How it works
What happens, step by step
Every 10 minutes it checks your Drive Outbox folder for new files.
It reads the recipient's phone number from the start of each file name.
The file is uploaded to WhatsApp and sent to that number as a document.
The file is moved to your Sent folder so it isn't sent again.
Before it runs live
- Connect Google Drive
- Connect WhatsApp Business
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
- Add an AI step, for example to summarize, sort or draft a reply
- 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
from clickruntime import on_trigger, credentials, http, report_fetched
OUTBOX, SENT = "outbox-folder-id", "sent-folder-id"
PHONE_ID = "your-phone-number-id"
drive = lambda: build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
@on_trigger
def run(event):
files = drive().files().list(q=f"'{OUTBOX}' in parents and trashed=false", fields="files(id,name,mimeType)").execute()["files"]
files = [f for f in files if f["name"].split(" ")[0].isdigit()]
report_fetched(len(files))
if not files:
return {"summary": "Nothing to send"}
h = {"Authorization": f"Bearer {credentials.secret('WHATSAPP_TOKEN')}"}
for f in files:
data = drive().files().get_media(fileId=f["id"]).execute()
media_id = http.post(f"https://graph.facebook.com/v20.0/{PHONE_ID}/media", headers=h, data={"messaging_product": "whatsapp"},
files={"file": (f["name"], data, f["mimeType"])}).json()["id"]
http.post(f"https://graph.facebook.com/v20.0/{PHONE_ID}/messages", headers=h, json={"messaging_product": "whatsapp",
"to": f["name"].split(" ")[0], "type": "document", "document": {"id": media_id, "filename": f["name"].split(" ", 1)[-1]}}).raise_for_status()
drive().files().update(fileId=f["id"], addParents=SENT, removeParents=OUTBOX).execute()
return {"sent": len(files)}FAQ
Common questions
How does it know who to send to?
Is there a size limit?
Can the customer reply?
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
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.
See how it worksSave 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 worksSee new job listings as they're posted
Jobs that match your keywords show up in a Slack channel, each one only once.
See how it worksKeep exploring
Set up “Send finished files from Drive to people on WhatsApp” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.