Every 5 minutes
Draft replies to support emails from your Drive help docs
Each new support email gets a draft reply in Gmail, written from the help documents you keep in Drive.
- Runs
- Every 5 minutes
- Apps
- Google Drive, Pinecone
- AI
- Yes, uses the built-in AI allowance
- Access
- Pinecone read; Drive read; Gmail compose
Send this to your assistant
Create a ClickRuntime automation: every 5 minutes, check my support inbox for new emails, look up the answer in my Pinecone index of Drive help docs, and save a draft reply in Gmail. Post the trickier ones to #support.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Support emails repeat the same twenty questions, and the answers are already written in your help docs. Still, someone has to find the right doc and adapt it for every email, and replies slow down whenever the person who knows the docs best is away.
Small support teams, online shops and SaaS founders use it to start every reply from the right help article, so answers are faster and consistent.
What you get out of it
Every email starts half-answered
A draft based on the right help doc is waiting in Gmail.
Consistent answers
Replies follow what your documentation says, not what each person remembers.
Tricky ones flagged
Emails the docs do not cover are posted to Slack so someone picks them up.
You still press send
Drafts are reviewed by a person before anything reaches a customer.
How it works
What happens, step by step
Every 5 minutes, ClickRuntime checks your support inbox for new emails it has not handled.
Each email is matched against your help documents in Pinecone.
AI writes a reply using only those documents, or flags that they do not cover the question.
Covered emails get a draft reply in Gmail; the rest are posted to your Slack support channel.
Before it runs live
- Connect Google Drive
- Connect Pinecone
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 Pinecone steps into one automation
Under the hood
The code that runs this automation
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, report_fetched, credentials, http, notify, ai
DRAFTED_LABEL_ID = "Label_789"
HOST, NS = "https://docs-abc123.svc.aped-1234.pinecone.io", "company" # your index host and namespace
def search(text, k=5):
r = http.post(f"{HOST}/records/namespaces/{NS}/search", json={"query": {"inputs": {"text": text}, "top_k": k}}, headers={
"Api-Key": credentials.secret("PINECONE_API_KEY"), "X-Pinecone-API-Version": "2025-04"}).json()
return [h["fields"] for h in r["result"]["hits"]]
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users()
new = gmail.messages().list(userId="me", q="label:Support -label:Drafted newer_than:1d").execute().get("messages", [])
report_fetched(len(new))
if not new:
return {"new": 0}
for m in new:
msg = gmail.messages().get(userId="me", id=m["id"], format="metadata", metadataHeaders=["From", "Subject"]).execute()
h = {x["name"]: x["value"] for x in msg["payload"]["headers"]}
docs = "\n\n".join(f"[{d.get('file_name')}] {d['chunk_text']}" for d in search(f"{h.get('Subject')} {msg['snippet']}", 4))
reply = ai.generate(f"Write a helpful support reply using only these help docs. If they don't cover it, reply exactly "
f"NO_ANSWER.\n{docs}\n\nCustomer email: {h.get('Subject')}\n{msg['snippet']}", max_output_tokens=400).text
if "NO_ANSWER" in reply:
notify.slack(f"Needs a person: {h.get('Subject')} from {h.get('From')}", channel="#support")
else:
gmail.drafts().create(userId="me", body={"message": {"threadId": msg["threadId"], "raw": base64.urlsafe_b64encode(
f"To: {h.get('From')}\r\nSubject: Re: {h.get('Subject')}\r\n\r\n{reply}".encode()).decode()}}).execute()
gmail.messages().modify(userId="me", id=m["id"], body={"addLabelIds": [DRAFTED_LABEL_ID]}).execute()FAQ
Common questions
How does it know which emails are support?
What if the docs don't cover the question?
Does it learn from my edits?
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
Get an analysis of each new earnings report compared with past quarters
When a new earnings report lands in your Drive folder, it is indexed and you get an email comparing it with earlier quarters.
See how it worksGet an accounting summary for each new EDI or export file in Drive
When a new EDI or accounting export lands in your Drive folder, it is indexed and you get an email summarising its bookings.
See how it worksKeep a Pinecone index in step with a Drive folder
New and edited files in your Drive folder are added to Pinecone within minutes, and files you remove are taken out of the index.
See how it worksKeep exploring
Set up “Draft replies to support emails from your Drive help docs” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.