1. The Real Challenge Jane Faces as an Accounts Payable Specialist
Jane, an accounts payable specialist at a mid-sized company, spends hours each day scanning her Gmail inbox for new invoice emails. These invoices often come from multiple vendors, and missing or delaying the payment of just one can mean late fees or strained business relationships. Despite her diligence, Jane sometimes overlooks invoice details or fails to alert her finance team quickly, causing delays that cost the company both money and reputation.
Every day, Jane receives dozens of emails with complex invoice attachments. Manually verifying if an email contains an invoice, extracting the total amount due, and sending notifications is time-consuming and error-prone. With growing email volume, this process becomes unsustainable and stressful.
Imagine Jane spending up to two hours daily just on this repetitive task—not counting interruptions—and how those wasted hours could be better spent on strategic financial planning or vendor negotiations. This specific workflow directly addresses Jane’s pain by automating these exact steps.
2. What This Automation Does
This n8n workflow is designed to automatically scan new Gmail emails, identify those containing invoices, extract invoice amounts using Mindee’s AI-powered document processing, and then notify the finance team efficiently. When the workflow runs:
- It checks the Gmail inbox for new emails continuously.
- Filters emails whose body text includes the keyword “invoice”.
- Extracts the total invoice amount from the attached invoice via Mindee’s Invoice API.
- If the invoice amount exceeds $1,000, it automatically sends an email alert to the finance manager for approval.
- Sends a new invoice notification to the company’s Slack channel including the sender, subject, amount, and date.
- Ensures the finance team never misses high-value invoices and can quickly act to avoid delays.
This automation saves Jane approximately two hours per day, reduces human errors, and accelerates invoice processing, leading to better cash flow management and vendor relationships.
3. Prerequisites ⚙️
- Gmail account configured with IMAP access (used by the Email Read IMAP node).
- Mindee Invoice API account for invoice data extraction from attachments.
- Slack workspace with an access token to send notifications to a team channel.
- SMTP email account for sending notification emails (e.g., Mailtrap or any SMTP service).
- n8n account (self-hosted or cloud) to create and run this workflow.
If you prefer self-hosting n8n for full control, services like Hostinger offer easy setups.
4. Step-by-Step Guide to Build This Workflow
Step 1: Set Up the Email Read IMAP Node to Monitor Gmail Inbox
Navigate to ‘+ Add Node’ → Search and select Email Read IMAP.
Configure your Gmail IMAP credentials under the ‘credentials’ tab.
Set the mailbox to Inbox and format as resolved.
Ensure allowUnauthorizedCerts is enabled if needed.
This node will periodically fetch new emails from your Gmail Inbox.
Common mistake: Forgetting to enable IMAP in Gmail settings or incorrect credentials causes no emails to be fetched.
Step 2: Add an IF Node to Filter Emails Containing Keyword “Invoice”
Add a new node and select IF node.
Set the condition: Check if the email body text (accessed as {{$json["text"].toLowerCase()}}) contains invoice.
Use the ‘string contains’ operation in the condition tab.
Connect the output of the Email Read IMAP node to this IF node.
This filters only relevant emails that most likely are invoices.
Common mistake: Case sensitivity issues—always convert text to lowercase before search.
Step 3: Add the Mindee Node to Extract Invoice Data from Attachments
Add the Mindee node which supports invoice extraction.
Select resource invoice.
Set the binary property name to the first attachment name, usually attachment_0.
Authenticate using your Mindee Invoice API credentials.
This node sends the invoice attachment to Mindee’s AI to return structured data including the total amount.
Common mistake: Attachment binary property name mismatch or unsupported attachment format.
Step 4: Add an IF Node to Check if Invoice Amount > 1000
Add another IF node.
Set condition to check if {{$json["predictions"][0]["total_incl"]["amount"]}} is larger than 1000.
Connect the output of Mindee node to this IF node.
This step filters only high-value invoices requiring manager approval.
Common mistake: Incorrect JSON path to the amount field—verify with Mindee output.
Step 5: Configure Email Send Node to Notify Finance Manager
Add Email Send node.
Configure SMTP credentials (Mailtrap or your SMTP service).
Set recipient to [email protected] and from email to [email protected].
Subject: “New high value invoice”.
Body: “Hi, There is a new high value invoice to be paid that you may need to approve. ~ n8n workflow”.
Attach the invoice file by specifying attachment_0.
Connect this node as true branch output of the IF node checking amount.
Common mistake: SMTP misconfiguration causing failed email sends.
Step 6: Add Slack Node to Send Notification Message
Add Slack node.
Authenticate with Slack API token.
Set the channel to your team’s accounts channel, e.g., team-accounts.
Message text: “:new: There is a new invoice to pay :new:”.
Add an attachment block with fields for Amount, From (email sender), Subject, and Date.
Use expressions referencing previous nodes to populate these fields.
Connect the Email Send node to the Slack node so it runs after finance manager notification.
Also, link the false branch of the amount IF node here to ensure all invoices generate Slack alerts.
Common mistake: Incorrect channel ID or missing permissions in Slack app.
Step 7: Testing Your Workflow
Test the full workflow by sending a test invoice email with an attachment to your Gmail account.
Watch the workflow’s executions in n8n UI; check Slack channel and finance manager email for notifications.
If you don’t see expected results, review each node’s output logs to debug.
5. Customizations ✏️
- Change the invoice keyword: In the IF node named “If email body contains invoice,” update the condition value to catch other keywords like “bill” or “statement” to expand filtering.
- Set different thresholds for notifications: Adjust the amount in the IF node “If Amount > 1000” to any value, like 500 or 2000, based on company policy.
- Add multi-channel notifications: Use additional nodes such as Microsoft Teams or Telegram instead of Slack by swapping out the Slack node and updating credentials.
- Log invoice data to Google Sheets: Add a Google Sheets node after Mindee to record each invoice’s details into a spreadsheet for historical tracking and auditing.
- Multi-condition approvals: Combine additional conditions in IF nodes, like due date approaching or vendor name, to route approvals differently.
6. Troubleshooting 🔧
- Problem: “No emails found or processing stopped unexpectedly.”
Cause: Incorrect Gmail IMAP credentials or IMAP not enabled in Gmail.
Solution: Double-check Gmail account settings to enable IMAP. Re-enter credentials in Email Read IMAP node and test connection. - Problem: “Mindee API returns empty or invalid data.”
Cause: Attachment is not a supported invoice format or binary property name is incorrect.
Solution: Ensure invoice is a clear PDF or image supported by Mindee and set the correct binary property name (usually ‘attachment_0’). Test Mindee node separately. - Problem: “Emails not reaching Slack channel or finance manager.”
Cause: Slack token lacks permissions or SMTP credentials are incorrect.
Solution: Verify Slack app permissions and channel ID, test sending manual Slack messages. Recheck SMTP settings.
>
7. Pre-Production Checklist ✅
- Confirm Gmail IMAP credentials and connection.
- Verify Mindee credentials and confirm invoice extraction accuracy.
- Check correct JSON path to invoice amount in IF conditions.
- Test Slack channel ID and API token permissions.
- Send test emails with invoice attachments matching expected file formats.
- Backup current workflow before enabling active run.
8. Deployment Guide
Activate the workflow in n8n once fully tested by clicking Activate in the workflow editor.
Maintain monitoring by checking recent executions for errors or skipped emails.
Set up alerting in n8n to notify if the workflow stops for any reason.
The workflow runs continuously, so no manual trigger is needed once enabled.
Optional: Schedule a daily summary email by adding a Cron node and aggregation steps if desired.
9. FAQs
- Can I use Outlook instead of Gmail? Yes, by swapping the Email Read IMAP node’s credentials and mailbox settings to your Outlook IMAP details.
- Does this use Mindee API credits? Yes, each invoice processed calls the Mindee API and consumes your account credits.
- Is my data secure? The workflow uses secure tokens and credentials stored in n8n. Mindee and Slack APIs use encrypted HTTPS calls.
- Can this handle hundreds of emails daily? It depends on your n8n instance and API rate limits. Scale your resources accordingly.
10. Conclusion
By building this custom n8n workflow, you’ve automated the tedious and error-prone process of monitoring your Gmail inbox for new invoice emails, extracting invoice totals using Mindee AI, and promptly notifying your finance team via Slack and email. This saves you up to two hours daily, reduces missed payments, and improves team communication.
Next, you might consider automating invoice payment status updates, integrating a Google Sheets logging system for audit trails, or expanding notifications to multiple team members and channels.
Keep experimenting with n8n’s diverse nodes to build smarter, valuable automations tailored to your unique business needs.