Reconcile bank payments to invoices and ERP using Postgres and Claude
Quick overview This workflow reconciles incoming bank transactions against open invoices and existing ERP payment records, optionally escalating borderline matches to Anthropic Claude for review, persisting results in Postgres, and notifying a finance team via Slack while returning a run summary to webhook callers.
How it works Starts a reconciliation run via a manual trigger, a daily 06:00 schedule, or a POST webhook request. Ensures the required Postgres tables exist and loads previously reconciled bank transaction and invoice IDs to make the run idempotent. Fetches open invoices and ERP payments from an ERP API and bank transactions from a bank API, then normalizes all three datasets into a consistent schema. Validates that all source API calls succeeded, then runs a rules-based matching engine to score and classify matches and generate exceptions (for example unmatched payments, overdue invoices, duplicates, and ERP conflicts). Sends borderline matches to Anthropic Claude for approve/reject/escalate decisions and applies those decisions with confidence and variance guardrails. Upserts matches, exceptions, and run summaries into Postgres, optionally posts auto-matched payments back to the ERP API with an idempotency key, and sends a Slack webhook alert only when items need review or exceptions exist. Returns the final reconciliation summary as JSON to the webhook caller or logs the run as failed in Postgres and responds with HTTP 502 if any source API fails.
Setup Add a Postgres credential and ensure the database user can create tables and read/write the reconciliation_runs, reconciliation_matches, and reconciliation_exceptions tables. Update the source API URLs, query parameters, field mappings, and authorization headers for your ERP and bank systems in the configuration code. Add your Anthropic API key (and optionally disable AI review) by updating the Claude settings in the configuration code. (Optional) Create a Slack incoming webhook and set its URL in the configuration code to receive alerts when attention is needed. (Optional) Enable ERP write-back and set the ERP apply-payments endpoint and credentials after validating results in dry runs.
Related Templates
AI Weather Forecasts with MCP Integration
Real-time Weather Forecasts with MCP Tools This n8n workflow demonstrates how to integrate real-time weather intelligen...
Extract Named Entities from Web Pages with Google Natural Language API
Who is this for? Content strategists analyzing web page semantic content SEO professionals conducting entity-based anal...
Google Sheets UI for n8n Workflow
Google Sheets UI for Workflow Control This n8n template provides a practical and efficient way to manage your n8n workf...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments