Quick overview
This workflow watches a Google Drive folder for new invoices, extracts invoice fields with Anthropic Claude vision, validates totals and checks for duplicates in Google Sheets, then auto-approves low-risk invoices or pauses for human approval before logging results and moving files to Processed or Flagged.
How it works
- Triggers when a new file is created in a specific Google Drive “Inbox” folder (or runs manually with a test file ID).
- Downloads the invoice file from Google Drive, converts the binary to base64, and prepares an Anthropic Messages API request for Claude vision.
- Calls Anthropic Claude to extract structured invoice data as JSON, then parses the response and flags the run if extraction cannot be parsed.
- Performs a deterministic math check (subtotal + tax vs total) and reads a Google Sheets ledger to detect duplicate invoice numbers.
- Routes invoices needing review (extraction failure, math mismatch, or duplicate) or invoices at/above the configured amount threshold to a human approval step by sending approve/reject links to a webhook and waiting for the decision.
- Computes the vendor’s prior approved spend from Google Sheets, appends a normalized ledger row with the final approval status, and moves the invoice file in Google Drive to either the Processed or Flagged folder while sending a final outcome notification via webhook.
Setup
- Create and connect Google Drive credentials with access to an Inbox, Processed, and Flagged folder, then paste those folder IDs into the workflow Settings.
- Create a Google Sheets ledger with the required header columns and add Google Sheets credentials, then select the correct spreadsheet and sheet in the duplicate check, vendor total, and ledger append steps.
- Create an Anthropic API key and add it as an HTTP Header Auth credential (header
x-api-key) for the Claude vision HTTP request.
- Set the Settings values for
approvalThreshold, anthropicModel, and notifyWebhookUrl (the endpoint that receives the approval request text and posts the approve/reject links).
- Enable the Google Drive trigger to point at your Inbox folder, and optionally set
testFileId to validate the workflow end-to-end before processing real invoices.