INVOICE PROCESSING

Three-Way Match Invoice Router with Exception Approval

Matches each incoming vendor invoice against its open purchase order and goods receipt in Postgres, auto-approves clean matches.

CategoryInvoice Processing
Enginesim
Difficultyintermediate
Triggerevent
Steps6
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerNew invoice row inserted in PostgresPostgreSQLPostgres
  • ActionFetch matching PO and goods receiptPostgreSQLPostgres
  • LogicCompare price, quantity, and total to tolerance
  • ActionMark clean matches approved for paymentPostgreSQLPostgres
  • LogicClassify exception type for mismatches
  • OutputPost exception to Slack approval threadSlack

What it does

Runs the core three-way match. For every new invoice it pulls the referenced purchase order and the goods-receipt record from your AP database, compares line-item price, quantity, and total against tolerance thresholds, and decides whether the invoice can pay automatically or needs a human.

When to use it

When your AP team manually cross-checks invoices against POs and receiving records before approving payment, and clean invoices are slowing down because they sit in the same queue as the genuine exceptions.

How it works

  1. 1A new invoice row lands in the Postgres `invoices` table and fires the trigger.
  2. 2The flow looks up the matching purchase order and goods receipt by PO number.
  3. 3A logic step compares unit price, quantity, and extended total against configured tolerance (e.g. +/- 2% price, exact qty).
  4. 4Clean matches are marked `approved` in Postgres for the payment run.
  5. 5Any mismatch is classified by exception type (price variance, quantity variance, missing receipt).
  6. 6Exceptions post to a Slack approval thread with the variance detail and Approve/Reject buttons for the AP lead.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect PostgresAny Postgres URL — query, write, migrate.
  2. 2
    Connect SlackChannels, DMs, threads, mentions.
  3. 3
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  4. 4
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  5. 5
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.