Send milestone billing invoices with Google Sheets, GPT-4o mini, Gmail and Slack
Quick Overview This workflow polls a Google Sheets milestone tracker every 15 minutes, calculates milestone-based invoice amounts, uses OpenAI (gpt-4o-mini) to draft invoice messaging, emails the invoice via Gmail with an approval link, then records approval in Google Sheets and notifies an accounts Slack channel.
How it works Runs every 15 minutes and reads milestone rows from a Google Sheets “Milestones” tab. Filters for milestones where % Complete is at or above the Invoice Trigger % and the Invoice Status is Pending. Calculates the billable amount, generates an invoice ID, and asks OpenAI (gpt-4o-mini) to return a JSON invoice narrative, payment terms, email subject, and HTML email body. Builds an approval URL token, generates a styled HTML invoice document, and sends the invoice email to the client via Gmail with an Approve Invoice button. After the email step returns an approval result, updates the milestone status to Sent, appends a record to the Google Sheets “Invoice Log” tab, and stamps the approval timestamp in the Milestones tab. Posts a Slack message to the accounts team with the milestone ID and approval timestamp, and sends a Slack alert if the workflow errors.
Setup Add Google Sheets OAuth2 credentials and replace the spreadsheet document ID and sheet tabs for both the “Milestones” and “Invoice Log” operations. Add an OpenAI credential (used with the gpt-4o-mini model) and adjust the prompt/model if you want different invoice wording. Add a Gmail OAuth2 credential and update the recipient address in the Gmail node (CLIENT_EMAIL@example.com) to your client email field or target address. Add Slack OAuth2 credentials and replace both Slack channel IDs (error alerts and accounts notifications) with your workspace channels. Replace YOUR_N8N_WEBHOOK_BASE_URL in the approval URL builder with your live n8n base URL and ensure your Milestones sheet includes the required columns (Milestone ID, Contract ID, Client Name, % Complete, Invoice Trigger %, Contract Value ($), Invoice Status, Currency).
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 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...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments