Quick Overview
Quick Overview This workflow receives vendor invoices via a webhook, uses OpenAI with Google Sheets-based vendor and approval policy data to decide auto-approval vs human review, logs every invoice to Google Sheets, and sends outcome notifications through Gmail and Telegram. How it works Receives an invoice submission via a POST webhook request. Normalizes the incoming fields and validates that vendor email, invoice number, and amount are present. If required fields are missing, sends a Telegram alert and emails an intake-error notice. If valid, uses an OpenAI chat model that consults Google Sheets (VendorMaster and ApprovalPolicy) to produce an approval decision, suggested approver, reason, and confidence. Parses the AI output, calculates default due dates and approval deadlines, and applies deterministic rules to force human review when the amount is over 500,000 or the vendor is not in the known-vendor list. Appends the invoice record and decision details to an Invoices tab in Google Sheets. Sends Gmail and Telegram notifications either confirming auto-approval to the vendor and finance, or requesting review from the suggested approver and alerting finance. Setup Create/prepare a Google Sheets file with VendorMaster, ApprovalPolicy, and Invoices tabs (with columns matching the workflow mappings) and update the document ID if you use a different spreadsheet. Add Google Sheets OAuth2 credentials that can access the spreadsheet. Add an OpenAI API credential for the OpenAI chat model used by the AI agent. Add Gmail OAuth2 credentials and update the recipient addresses (including the invalid-intake notification address and the approver fallback like finance@yourcompany.com). Add Telegram bot credentials and set the target chat ID for finance alerts. Copy the webhook URL for the ap/invoice endpoint and configure your invoice source system to POST the required fields (vendor_name, vendor_email, invoice_number, amount, and optional currency/category/due_date). An n8n automation workflow template by Khairul Muhtadin.
Khairul Muhtadin
web
free
Others in the same category, ranked by how often they are opened.