On a schedule
Draft email replies from your FAQ Google Doc
New customer emails get a draft reply in Gmail based on the answers in your FAQ Google Doc, ready for you to check and send.
- Runs
- On a schedule
- Apps
- Google Docs, Pinecone
- AI
- Yes, uses the built-in AI allowance
- Access
- Docs read; Pinecone key
Send this to your assistant
Create a ClickRuntime automation: keep my FAQ Google Doc indexed in Pinecone and re-index it daily. Every 10 minutes, for each new email in my inbox, find the relevant answers and save a draft reply in Gmail.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A two-person team running an online homeware shop answers the same questions every day: delivery times, returns, care instructions, whether an item will be restocked. The answers are already written in an FAQ document, but each reply still means finding the right paragraph and rewording it for the customer.
Having a draft waiting in Gmail, built from the FAQ, turns most replies into a quick check and a click on Send. Small shops, service businesses and support teams without a help desk tool use it to answer faster while keeping every reply consistent with their policies.
What you get out of it
Replies start from your own answers
Drafts are built from the FAQ document your team already maintains, not from general knowledge. Delivery times, return windows and prices match what you have written.
You still decide what is sent
Nothing is sent automatically. Each reply is saved as a draft, so you can adjust tone or add details before it reaches the customer.
Faster first responses
Customers get an answer in minutes rather than at the end of the day. Quick replies reduce follow-up emails and abandoned orders.
Update the FAQ, update the replies
Change a policy in the Google Doc and the next day's drafts use the new wording. There is no separate set of saved replies to keep in sync.
How it works
What happens, step by step
Once a day, ClickRuntime reads your FAQ Google Doc, splits it into short sections and stores them in your Pinecone index.
Every 10 minutes, it checks your Gmail inbox for emails that have arrived since the last check.
For each new email, it finds the FAQ sections that best match the question.
AI writes a reply using only those sections, and it is saved as a draft in the same Gmail thread for you to review.
Before it runs live
- Connect Google Docs
- 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
- Run it at a different time, more or less often, or only on weekdays
- 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 Docs and Pinecone steps into one automation
Under the hood
The code that runs this automation
import base64
from datetime import date
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched
DOC_ID, INDEX = "your-doc-id", "https://faq-xxxx.svc.pinecone.io"
def pc(path, body):
return http.post(INDEX + path, json=body, headers={"Api-Key": credentials.secret("PINECONE_API_KEY")}).json()
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
if state.get("indexed") != date.today().isoformat():
doc = build("docs", "v1", credentials=creds, cache_discovery=False).documents().get(documentId=DOC_ID).execute()
paras = [p for p in ("".join(r["textRun"]["content"] for r in c.get("paragraph", {}).get("elements", []) if "textRun" in r)
for c in doc["body"]["content"]) if p.strip()]
pc("/records/namespaces/faq/upsert", [{"_id": f"p{i}", "text": p} for i, p in enumerate(paras)])
state.set("indexed", date.today().isoformat())
gmail = build("gmail", "v1", credentials=creds, cache_discovery=False).users()
since = state.get("since")
msgs = gmail.messages().list(userId="me", q=f"in:inbox after:{since}" if since else "in:inbox newer_than:10m").execute().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"summary": "Nothing new"}
for m in msgs:
full = gmail.messages().get(userId="me", id=m["id"], format="full").execute()
hdr = {h["name"]: h["value"] for h in full["payload"]["headers"]}
hits = pc("/records/namespaces/faq/search", {"query": {"inputs": {"text": full["snippet"]}, "top_k": 4}})
ctx = "\n".join(h["fields"]["text"] for h in hits["result"]["hits"])
reply = ai.generate(f"FAQ:\n{ctx}\n\nCustomer email:\n{full['snippet']}\n\nWrite a short reply using only the FAQ.", max_output_tokens=500).text
msg = EmailMessage()
msg["To"], msg["Subject"] = hdr.get("From"), "Re: " + hdr.get("Subject", "")
msg.set_content(reply)
gmail.drafts().create(userId="me", body={"message": {"threadId": full["threadId"], "raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}}).execute()
state.set("since", int(gmail.messages().get(userId="me", id=msgs[0]["id"], format="minimal").execute()["internalDate"]) // 1000 + 1)
return {"drafts": len(msgs)}
FAQ
Common questions
What if the FAQ does not cover the question?
Which emails get a draft?
Why is the FAQ stored in Pinecone?
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
Index reports in Pinecone and write an analysis to Google Docs
Your report documents are indexed in Pinecone, and each quarter an AI analysis drawing on them is written into a new Google Doc.
See how it worksGive your Telegram bot a long-term memory
Tell your Telegram bot things as they come up and ask about them later; it remembers what you said and keeps a running notes Doc.
See how it worksDraft Google Docs from your stored research
Add a topic to your list and get a first draft in Google Docs built from the notes in your knowledge base.
See how it worksKeep exploring
Set up “Draft email replies from your FAQ Google Doc” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.