Every 10 minutes
Draft replies to customer emails using your Airtable orders
When a customer emails, a reply with their real order details is waiting in your Gmail drafts.
- Runs
- Every 10 minutes
- Apps
- Airtable, Gmail
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail gmail.modify or gmail.compose; Airtable read
Send this to your assistant
Create a ClickRuntime automation: when a customer emails, look up their order in my Airtable Orders table and draft a reply in Gmail.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small online shop gets thirty emails a day asking where an order is or when it will ship. Each one means opening Airtable, searching for the customer, copying the status and tracking number, and typing a reply.
Having a draft ready with the right order details turns each of those emails into a quick check and send, while a person still decides what goes out.
What you get out of it
Faster answers to order questions
Customers get a reply sooner because the slow part, finding the order, is already done when you open the draft.
You still approve every reply
Replies are saved as drafts, not sent, so you can correct anything before the customer sees it.
Correct details every time
Status, dates and tracking numbers come from your order table, so you do not mistype a number while switching windows.
A consistent tone
Drafts follow the voice you describe, so replies sound the same whoever on the team sends them.
How it works
What happens, step by step
Every few minutes ClickRuntime checks your Gmail for new customer emails.
It looks up the sender in your Airtable Orders table and skips emails it has already drafted for.
AI writes a reply using the customer's question and their order status, dates and tracking details.
The reply is saved as a draft in the same Gmail thread for you to check and send.
Before it runs live
- Connect Airtable
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
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 Airtable and Gmail steps into one automation
Under the hood
The code that runs this automation
import base64
from email.message import EmailMessage
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
from clickruntime import on_trigger, credentials, ai, report_fetched, http
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users()
msgs = gmail.messages().list(userId="me", q="label:support is:unread -label:drafted").execute().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"summary": "No new emails"}
for m in msgs:
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"]}
sender = h["From"].split("<")[-1].strip(">")
orders = http.get("https://api.airtable.com/v0/appXXXXXXXX/Orders", headers={"Authorization": f"Bearer {credentials.secret('AIRTABLE_API_KEY')}"},
params={"filterByFormula": f"{{Email}}='{sender}'", "maxRecords": 3}).json()["records"]
reply = ai.generate(f"Customer wrote: {msg['snippet']}\nTheir orders: {[o['fields'] for o in orders]}\nWrite a friendly, short reply.", max_output_tokens=300).text
draft = EmailMessage()
draft["To"], draft["Subject"] = sender, "Re: " + h.get("Subject", "")
draft.set_content(reply)
gmail.drafts().create(userId="me", body={"message": {"threadId": msg["threadId"], "raw": base64.urlsafe_b64encode(draft.as_bytes()).decode()}}).execute()
return {"drafted": len(msgs)}FAQ
Common questions
How does it find the right order?
What if no order is found?
Will it reply to suppliers or newsletters?
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
Turn emails that ask for something into Airtable tasks
Emails that ask you to do something become tasks in Airtable, with a clear title, a due date and a priority.
See how it worksScreen CVs from email into an Airtable candidate list
Application emails become Airtable records with the candidate's details and a score for the role.
See how it worksLog invoice emails as payables in Airtable
Invoices that arrive by email are read and added to your Airtable payables table with vendor, amount, due date and invoice number.
See how it worksKeep exploring
Set up “Draft replies to customer emails using your Airtable orders” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.