Every 15 minutes
Email PDF invoices from Airtable when a record is ready
Set an invoice or quote to Ready in Airtable and the client receives it as a PDF from your Gmail.
- Runs
- Every 15 minutes
- Apps
- Airtable, Gmail
- AI
- Not needed
- Access
- Airtable read+write; Gmail gmail.send
Send this to your assistant
Create a ClickRuntime automation: when I set an Airtable invoice to Ready, generate a PDF and email it to the client from Gmail, then mark it Sent.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A freelance designer keeps clients, quotes and invoices in Airtable. Sending each one means exporting a document, saving it, writing an email, attaching the file and remembering to update the status. It is fiddly enough that invoices go out days late.
This automation watches for records you mark Ready, builds a PDF from the record's details, emails it to the client from your own Gmail and marks the record Sent. Changing one field is all it takes to bill a client.
What you get out of it
Get paid sooner
Invoices go out the moment the work is signed off, not when you find time to do the admin.
Every document looks the same
Quotes and invoices share one consistent layout built from your Airtable fields, without copy-and-paste mistakes.
Status you can trust
Records are marked Sent with the date once the email goes, so you always know which invoices are out.
Clients reply to you directly
The email comes from your own Gmail, so questions about the invoice land in your inbox, in the same thread.
How it works
What happens, step by step
Every few minutes ClickRuntime checks your Airtable table for records with the status Ready.
It builds a PDF quote or invoice from each record's details.
The PDF is emailed to the client from your Gmail.
The record is marked Sent, so it is never emailed again.
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
- 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 Airtable and Gmail steps into one automation
Under the hood
The code that runs this automation
import base64
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from fpdf import FPDF
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, report_fetched
URL = "https://api.airtable.com/v0/appXXXXXXXXXXXXXX/Invoices"
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.secret('AIRTABLE_API_KEY')}"}
recs = http.get(URL, headers=h, params={"filterByFormula": "{Status}='Ready'"}).json()["records"]
report_fetched(len(recs))
if not recs:
return {"sent": 0}
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
for r in recs:
f = r["fields"]
pdf = FPDF(); pdf.add_page(); pdf.set_font("Helvetica", size=12)
for line in (f"{f.get('Type', 'Invoice')} {f.get('Number', '')}", f"Client: {f.get('Client')}",
f"Items: {f.get('Items', '')}", f"Total: {f.get('Total')}", f"Due: {f.get('Due', '')}"):
pdf.cell(0, 10, line, new_x="LMARGIN", new_y="NEXT")
msg = MIMEMultipart(); msg["To"] = f["Client email"]; msg["Subject"] = f"{f.get('Type', 'Invoice')} {f.get('Number', '')}"
msg.attach(MIMEText("Please find your document attached. Thank you!"))
msg.attach(MIMEApplication(bytes(pdf.output()), Name=f"{f.get('Number', 'invoice')}.pdf"))
gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
http.patch(f"{URL}/{r['id']}", headers=h, json={"fields": {"Status": "Sent"}})
return {"sent": len(recs)}FAQ
Common questions
What goes on the PDF?
Will an invoice ever be sent twice?
Can it send quotes as well as invoices?
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
Require two approvals for Airtable change requests
Each new change request in Airtable is emailed to two approvers, and the change is applied only after both say yes.
See how it worksTurn 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 worksKeep exploring
Set up “Email PDF invoices from Airtable when a record is ready” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.