Recover overdue invoices with GPT-4o-mini, Gmail, Google Sheets and Slack
Quick overview This workflow runs every 24 hours to read overdue invoices from Google Sheets, uses OpenAI (GPT-4o-mini) to draft personalized recovery emails and determine escalation, sends emails via Gmail, logs outcomes back to Google Sheets, and posts status and error alerts to Slack.
How it works Runs every 24 hours on a schedule trigger. Reads invoice rows from a Google Sheets “invoices” tab and checks whether there are any valid invoice entries to process. If no invoices are found, posts a “no overdue invoices” message to a Slack channel. For each invoice found, uses OpenAI (GPT-4o-mini) to assign an escalation level, draft a personalized HTML email (including payment plans when applicable), and recommend an escalation action. Parses the AI output into structured fields and sends the recovery email to the client via Gmail. If the AI recommends escalation, sends an internal escalation alert email to the legal team via Gmail. Updates the invoice row in Google Sheets with the new escalation level and AI summary, then appends a full audit log row to a “Recovery sheet” tab. If AI processing fails, posts an error alert to Slack and continues with the next invoice.
Setup Add Google Sheets OAuth2 credentials and set the Spreadsheet ID plus the sheet names (“invoices” and “Recovery sheet”). Add an OpenAI API credential and ensure the GPT-4o-mini model is available for the AI agent. Add Gmail OAuth2 credentials and set the reply-to address and recipients (client email field and the internal legal email address). Add Slack OAuth2 credentials and set the target channel ID for both the “no invoices” and error alerts. Ensure your invoices sheet includes columns used by the workflow (Invoice, Client, Email, Amount, Due Date, Days Overdue, Reminders Sent, and row_number for updates).
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments