Skip to main content

Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres

Workflow preview

Workflow preview
100%
Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres preview
Open on n8n.io

1. Workflow Overview

WHAT you need 1. Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. 3. LINK to their website https://jigsawstack.com/ 6. SECOND A postgress DATABASE (I use [Supaba...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.httprequest, n8n-nodes-base.switch, n8n-nodes-base.postgres, n8n-nodes-base.webhook, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.executeworkflow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Stephan Koning.

Original n8n.io source

1.1 Workflow description

Title
Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres
Workflow name
Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres

WHAT you need

  1. Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes.
  2. LINK to their website https://jigsawstack.com/
  3. SECOND A postgress DATABASE (I use Supabase)
  4. LlamaCloud for the parsing (you can replace this with Jigsaw if you like)
  5. Redis (Optional , but I would strongly advise using it)
  6. agentMail , this is your trigger email adress and BOX
  7. Webhook Trigger (Svix or n8n's builtin webhook)

WHAT is it?

This is an easy way to track your SaaS spending, especially for small business owners or solopreneurs. It's essentially exactly what tools like Spendbase and Ramp do, without the virtual card.

HOW it works

After getting your API keys, all you need to do is set up an AgentMail inbox for your invoices. This is your trigger.

In the current setup, the workflow will only trigger if you send an attachment.

You can find more information on how to use the workflow in the workflow notes.

The database schema

You can find it as a deactivated code node in the workflow.

Free 15 min Onboarding Coffee

If you want I can walk you through the setup and you will have it up and running in no time. Free onboarding chat

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Post to JigsawStack API

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 10 - Route by Invoice Type

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 11 - Upsert Invoice Record

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 12 - AgentMail Webhook Trigger

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 13 - Fetch Download URL

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Acquire Pipeline Job

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 15 - Parse Acquire Result

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - If Job Acquired

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 17 - Prepare Skipped Log

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Log Skipped Event

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 19 - Handle SQL Error Details

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 20 - Extract Attachment Payload

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 21 - Prepare Complete Job

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Complete Pipeline Job

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 23 - Prepare Success Log

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 24 - Log Success Event

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Showing the first 24 of 72 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres
Complexity advanced
Nodes 72
Categories Invoice Processing, AI Summarization
Author Stephan Koning
Published 12 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14997/14997.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Track SaaS spend from email invoices with AgentMail, JigsawStack and Postgres do?

WHAT you need 1. Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. 3. LINK to their website https://jigsawstack.com/ 6. SECOND A postgress DATABASE (I use [Supaba...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.