Daily AI dunning emails for Tabs overdue invoices
Every morning, turn your overdue Tabs invoices into personalized Gmail recovery emails with tone matched to how late they are, and brief your finance team in Slack.
Build an agent workflow that runs an AI dunning sequence on Tabs overdue invoices every weekday at 8am local time. Trigger: cron.
Each run, the agent should:
1. Call Tabs List Invoices to get every invoice with overdue status. Tabs uses a filter query parameter with the syntax filter=fieldName||rule||value (supported rules include eq, neq, gt, gte, lt, lte, like, in, isnull, isnotnull). Filter on the invoice status field for the overdue value, and combine with a dueDate filter if needed by repeating the filter= parameter. Paginate through all pages (page-based, default limit 50; response envelope is payload.data with totalItems and currentPage).
2. For each overdue invoice, compute days past due from the due date and assign an aging bucket: 1 to 14 days = friendly nudge, 15 to 45 days = firmer reminder, 46+ days = escalation tone.
3. Call Tabs Get Customer for the invoice's customer to pull account details and the billing contact, and Tabs List Customer Contacts to confirm the billing contact email. Then call Tabs List Payments for that customer (filter by customer id) to read their payment history, so the email can reference whether they typically pay on time or have a pattern of late payments.
4. Before drafting, check whether this invoice has already been emailed in the last 5 days. The agent should look at its own send history (e.g. by searching the connected Gmail account's Sent mail for the invoice number in the past 5 days, or by tracking which invoices it has emailed in a small state store). If a match is found, skip the invoice.
5. Draft a tone-matched email per invoice. Always include the invoice number, the amount due, the original due date, and a clear next-step payment instruction. Match the tone to the aging bucket: friendly and conversational under 14 days, firmer and more direct between 15 and 45 days, escalation language with a clear consequence past 45 days. Reference the customer's payment pattern from Tabs Payments where relevant (e.g. acknowledge a usually-on-time payer, or note a repeated pattern of late payments).
6. Send each draft via Gmail Send a Message, to the billing contact email pulled from Tabs. Use a clear subject line that includes the invoice number so customer replies thread naturally in their inbox.
7. After all emails are sent, post a one-line summary to Slack in #finance-collections via Slack Bot Send a Message. The summary should list: total number of emails sent, breakdown by aging bucket, and the specific accounts that hit the 46+ day escalation tier so the finance team can follow up directly.
Important notes for the workflow author:
- Use the Tabs integration (apiKey credential) for all Tabs calls. Tabs auth header is Authorization: <apiKey> with no Bearer prefix.
- Use the Gmail integration (OAuth) to send the emails so they come from the user's own Gmail and replies land in their normal thread.
- Use the Slack Bot integration (not user OAuth) for the #finance-collections summary, since this is automated workspace output, not a person-authored message.
- Be defensive: if a customer has no billing contact email in Tabs, skip the invoice and include it in the Slack summary as needing a contact on file. If Tabs returns zero overdue invoices, still post a one-line Slack message saying everyone is current.
Additional information
What does this prompt do?
- Pulls every overdue invoice from Tabs each morning and groups them by how many days late they are.
- Looks up the customer's billing contact and payment history in Tabs so each email knows whether this account is usually on time or chronically late.
- Drafts a tone-matched email per invoice: a friendly nudge under two weeks, a firmer reminder in the one-to-six week range, and a clear escalation past 45 days.
- Sends each email from your Gmail so it lands in the existing customer thread, then posts a one-line wrap-up to a Slack channel for your collections team.
- Skips any invoice that already received a chase email in the last five days, so you never double-send.
What do I need to use this?
- A Tabs account with admin access so you can issue an API key for the workflow.
- A Gmail account that the emails will be sent from, ideally the address your customers already reply to.
- A Slack workspace with a channel like #finance-collections where the daily summary will be posted.
- An idea of which aging buckets you treat as friendly, firm, and escalation tone, so you can adjust the language.
How can I customize it?
- Change the schedule. Default is every weekday at 8am in your local time, but you can move it to weekends, weekly, or a specific timezone.
- Adjust the aging buckets and tone. The defaults are 1 to 14 days friendly, 15 to 45 days firm, and 46+ days escalation, but your collections policy may differ.
- Swap the Slack channel, change the wrap-up format, or send it as a direct message to your controller instead.
- Tighten or loosen the no-duplicate window. Five days is a sensible default for B2B, but weekly cadence is common too.
- Tell the agent to CC an internal collections owner, or to skip invoices below a minimum dollar amount.
Frequently asked questions
Will the emails actually look personal, or like an obvious template?
Where do the emails get sent from?
How does it avoid double-emailing the same customer?
Can I change the tone or the aging buckets?
Does it support customers with multiple contacts on the account?
Stop letting overdue invoices age in silence.
Connect Tabs, Gmail, and Slack once, and your dunning sequence runs every morning without anyone on finance lifting a finger.