Log Chargebee invoices into an Airtable table
A Chargebee + Airtable agent flow
Reconciling invoices out of Chargebee at month-end means clicking through pages of billing history and copying numbers into a sheet. An Airtable table that fills itself turns that into a query. The agent lists invoices with the List invoices tool, reads the ones generated since the last run, and writes a row per invoice with create_record: the invoice id, amount, status, and date. Chargebee answers the list call rather than pushing, so the agent reads on a cadence, hourly or nightly, and an invoice id already in the table is skipped. Finance gets a running, filterable ledger without anyone exporting a CSV.
The flow
List invoicesList invoices on the account with filtering and pagination.
create_recordCreate a new record in a table with the given field values.
Step by step
- List recent invoices
The agent calls List invoices sorted newest-first and reads down until it reaches an invoice id it has already logged. Each entry carries the invoice id, total, status, and date.
- Dedupe on invoice id
Before writing, it searches the table for the invoice id so an overlapping window doesn't log the same invoice twice. Only ids new to the table proceed.
- Write the row
create_record adds a record with the invoice id, amount, currency, status, the customer id, and the invoice date as typed fields, building a chronological ledger in Airtable.
Tell your agent
Every night, list Chargebee invoices generated since the last run, and for each invoice id not already in my Airtable Invoices table, add a row with the invoice id, amount, currency, status, customer id, and date. Skip ids already logged.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- List invoices returns invoice summaries carrying the customer id, not the customer's name or email. If the table should show who was billed, the agent resolves the customer with Find customer by ID as a second call per invoice, or per unique customer to save requests.
- Invoice status changes over time, paid, voided, refunded. A logged invoice can go stale, so decide whether the agent only appends new invoices or also re-reads recent ones by id and updates the row's status with update_records.
- create_record appends unconditionally. Dedupe on the invoice id, and store the amount as a number and the date as a date field, or month-end roll-ups in Airtable won't compute.
Questions
- Can it pull the line items on each invoice?
- List invoices returns the invoice header. Itemized lines come from the invoice detail, so the agent would fetch each invoice individually and write its line items to a child table, which is a heavier per-invoice read.
- How do I keep statuses current without re-logging?
- Run a second light pass that re-reads invoices from the last N days by id and calls update_records on the matching Airtable row when the status changed, leaving older settled invoices untouched.