Skip to content

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.

Paste it into your assistant. It tells you what it will send or change before it runs live.

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

  1. Every few minutes ClickRuntime checks your Airtable table for records with the status Ready.

  2. It builds a PDF quote or invoice from each record's details.

  3. The PDF is emailed to the client from your Gmail.

  4. 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

RunsEvery 15 minutes
Email PDF invoices from Airtable when a record is readytoday, 9:00Succeeded
Gmail · SentInvoice INV-0142 sent to accounts@acme.example with INV-0142.pdf attached.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
quotes_and_invoices_from_airtable_emailed_as_pdf.pyexample
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?
The fields from the record, such as client, line items, totals, due date and your payment details. You choose which fields appear.
Will an invoice ever be sent twice?
No. Once sent, the record's status changes to Sent, and only records marked Ready are picked up.
Can it send quotes as well as invoices?
Yes. A type field on the record decides whether the PDF is titled Quote or Invoice, and both are sent the same way.
What permissions does it need?
Airtable read+write; Gmail gmail.send. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

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.