Skip to content
AdvancedPremiumEmail AutomationWebhook trigger23 nodes

Digest long emails: PostgreSQL + AI agent

Fires the moment a webhook arrives across PostgreSQL, Gmail and Slack, hands the decision to an AI agent with its own tools, then branches on the check before anything is written. Built for inbox triage, around a "Stamp & Shape Email" step, in 23 documented nodes.

Digest long emails with PostgreSQL and Gmail automatically. An original, ready-to-import n8n workflow built around the 'AI Summarize & Route' pattern for marketing & advertising. It fires on a webhook and orchestrates 23 nodes across PostgreSQL, Gmail, Slack. It uses n8n's LangChain AI nodes (Agent/Chain + chat model). Retry-on-fail is enabled on external calls. Import the JSON, add your credentials, and adapt the parameters. What used to take a morning now runs on its own.

Key benefits

  • Keeps PostgreSQL and Gmail in step for inbox triage, without anyone re-typing a row
  • Safe to re-run: records already in PostgreSQL or Gmail are skipped, across all 23 nodes of this inbox-triage build
  • A failed PostgreSQL or Gmail call is retried rather than dropped, at any of the 23 nodes in this inbox-triage build
  • Branches rejoin before PostgreSQL, so a inbox-triage run reports once rather than 23 times
  • The inbox-triage AI step is isolated from PostgreSQL, so models swap without touching the other 23 nodes

Use cases

  • Teams keeping PostgreSQL and Gmail aligned by hand for inbox triage
  • Inbox triage work that needs a judgement call per item before it reaches PostgreSQL
  • Pushing inbox-triage events into PostgreSQL and Gmail the moment they land, not on the next poll
  • Inbox triage work where "Stamp & Shape Email" is still a manual step before PostgreSQL

Integrations

PostgreSQLGmailSlackGoogle SheetsHTTP / REST APIGroq

Workflow preview (23 nodes)

The template's actual node layout and connections. Node parameters and credential slots unlock with the download.

Receive Inbound WebhookWebhookStamp & Shape EmailSetPayload Valid?IfRecord Rejected InputGoogle SheetsReason & Act (AI Agent)AgentGroq Chat ModelLm Chat GroqCustom Logic ToolTool CodeLookup API DataTool Http RequestShape Agent OutputSetConfident Enough?IfDeliver Answer + Log to…PostgresEscalate to Human QueueGmailJoin OutcomesMergeSerialize Run Output (C…Convert To FileArchive Row SnapshotPostgresFingerprint for Idempot…CodeDrop Already-Processed …Remove DuplicatesSummarize Run StatsSetAppend Audit Row (Postg…PostgresSend Summary to SlackSlackCapture Failure ContextSetEscalate Failure to Gma…GmailPark in Dead-Letter Que…Postgres

What's inside (23 nodes)

A look at the node types this workflow uses. No purchase required — full parameters and credentials are yours after you buy.

AgentCodeConvert To FileGmailGoogle SheetsIfLm Chat GroqMergePostgresRemove DuplicatesSetSlackTool CodeTool Http RequestWebhook

Agent tools included (2)

An AI Agent is only as capable as the tools wired into it. These are read from the template's own graph — every one is a real node in the file you download.

  • Custom Logic Tool · Custom code
  • Lookup API Data · HTTP request

This agent runs without conversation memory - each run starts from the incoming request.

From download to running in 3 steps

  1. 1
    Import. In n8n, open Workflows → menu → “Import from File” and pick the downloaded JSON.
  2. 2
    Connect. Add your own credentials on the app nodes - n8n highlights exactly which ones need them.
  3. 3
    Activate. Run it once to test, then toggle Active. The automation is live.

What you'll learn

Production level

Production-grade: idempotency, dead-letter handling, and reconciliation included.

  • Routing classified output into separate action branches
  • Rejoining parallel branches with Merge so the run reports once
  • Moving data between Google Sheets, PostgreSQL and Gmail in a single run

Every node carries its own documentation on the canvas, plus notes explaining why the architecture was built this way, a credential setup guide, troubleshooting, and three practice exercises. Sample data comes pinned to the trigger, so you can hit Execute and watch data flow before connecting a single account.

Common questions

What exactly do I get?

The complete, ready-to-import n8n workflow as a JSON file, delivered instantly after payment. Import it into your own n8n (cloud or self-hosted), add your credentials, and it runs.

How do I import it into n8n?

In n8n, open Workflows, click the three-dot menu, choose “Import from File”, and select the downloaded JSON. Then connect your own app credentials on the highlighted nodes.

Do I need anything else for it to work?

You need your own n8n instance and accounts/credentials for the apps this workflow connects to (PostgreSQL, Gmail, Slack, Google Sheets, …). No coding is required.

What if it doesn't work for me?

If the file is faulty, won't import, or isn't as described, contact us within 7 days and we'll fix it or refund you - see our refund policy.

Can I modify or resell it?

You can freely adapt and use it in your own or your clients' projects. Reselling or redistributing the template file itself is not permitted.

Original n8n workflow template created and owned by WorkflowCrate. After purchase you receive the ready-to-import JSON file and a license to use and adapt it in your own projects.