Hourly invoice intake from email to Google Sheets with a Slack digest
Every hour, this agent reads your finance inbox, pulls vendor invoices and receipts into a tracking sheet, and posts a Slack digest with totals and anomalies.
Build me an invoice and receipt intake agent that runs on a cron schedule every hour during business hours (9am to 6pm on weekdays, in my local timezone). I want it to keep my finance tracking sheet and my #finance Slack channel up to date automatically.
On each run, the agent should call AgentMail List Messages on my finance@ inbox to fetch every message that arrived since the last run. For each new message, it should call AgentMail Get Message to pull the full body plus any PDF or HTML attachments.
Filter the messages down to vendor invoices and receipts. Treat a message as an invoice candidate when the sender domain looks like a real business (not a personal mail provider), the subject contains invoice or receipt language (invoice, receipt, statement, bill, payment due, paid), and there is at least one PDF attached or the body itself clearly reads as an invoice. Anything that does not match the filter should be ignored.
For every message that passes the filter, parse out: vendor name, invoice number, amount, currency, issue date, due date, and a short line item summary. Before logging anything, call Google Sheets Get Values on the invoice number column of my tracking sheet and check whether the parsed invoice number is already present. If it is, treat it as a duplicate and do not append.
For new invoices that parsed cleanly and are not duplicates, call Google Sheets Append Values to add one row per invoice to the tracking sheet. The row columns should be: vendor name, invoice number, amount, currency, issue date, due date, line item summary, and a link back to the AgentMail thread.
After each batch, call Slack Send a Message to post a digest to #finance. The digest should list every invoice that was logged this run with vendor, invoice number, and amount, the total dollar value across the batch, and a separate anomalies section. Anomalies include: messages that looked like invoices but could not be parsed cleanly, invoice numbers that were already in the sheet, and suspicious senders (lookalike domains, free mail providers claiming to be a vendor). For every anomaly, include a link back to the AgentMail thread so a human can pick it up.
Important: never silently drop anything. If parsing fails or something looks off, surface it in the Slack digest under anomalies rather than skipping it. If there are no new invoices and no anomalies on a given run, do not post a digest at all.
Additional information
What does this prompt do?
- Checks your finance inbox every hour during business hours and pulls every new vendor invoice or receipt, including PDF and HTML attachments.
- Extracts vendor name, invoice number, amount, currency, issue date, due date, and a line item summary, then appends one row per invoice to your tracking sheet.
- Checks the sheet first so the same invoice number is never logged twice, and links each row back to the original email thread.
- Posts a Slack digest to your finance channel after each run with the invoices logged, the total dollar value, and any anomalies that need a human.
What do I need to use this?
- An AgentMail inbox you use for finance mail, like finance@yourcompany.com.
- A Google Sheets tracking sheet with columns for vendor, invoice number, amount, currency, issue date, due date, line items, and a link back to the email.
- A Slack workspace and a channel where the digest should post, like #finance.
How can I customize it?
- Change the schedule. Run it every 30 minutes during month end close, or once a day if your invoice volume is lower.
- Tune the filters. Add trusted vendor domains, expand the subject keyword list, or require an attached PDF before logging.
- Swap the Slack channel, change the digest format, or send a separate alert when an invoice over a certain amount comes in.
Frequently asked questions
What kinds of invoices and receipts does this catch?
Will it log the same invoice twice if a vendor resends it?
What happens when an email cannot be parsed cleanly?
Does it work with multiple currencies?
Can I point it at a different inbox or channel later?
Stop hand keying vendor invoices into a spreadsheet.
Connect your finance inbox, your tracking sheet, and Slack once, and Geni handles the rest every hour.