See llms.txt for all machine-readable content.

Back to Templates

Capture and approve receipt bills from WhatsApp and Telegram with OpenAI and Xero

Quick overview

This workflow captures receipt images from Telegram or WhatsApp (via WAHA), extracts receipt details with OpenAI, creates a draft supplier bill in Xero with the receipt attached, requests manager approval in Slack, then authorizes or deletes the bill and replies back to the original chat.

How it works

  1. Triggers when a receipt image is received via a Telegram message or a WhatsApp WAHA webhook.
  2. Verifies the WAHA webhook HMAC (for WhatsApp), normalizes the inbound message, enforces an allowlist of requesters, and validates the file type and size.
  3. Checks an n8n Data Table for duplicate message keys or duplicate receipt image hashes, then downloads the image from Telegram or WAHA and validates the image bytes.
  4. Fetches the connected Xero tenant, active expense accounts, and active purchase tax rates, then uses OpenAI Vision to extract receipt fields and validates totals, currency, tax math, and category selection.
  5. Deduplicates again using a receipt fingerprint and an Xero invoice lookup, resolves or creates the supplier contact in Xero, creates an ACCPAY draft bill, and uploads the receipt as an attachment.
  6. Saves the pending state in the n8n Data Table and sends an approval request to a Slack channel where only specified Slack members can approve or reject within the timeout.
  7. Reloads the saved context, re-reads the Xero draft and attachment to confirm nothing changed, then sets the bill to AUTHORISED on approval or DELETED on rejection.
  8. Writes the final status back to the n8n Data Table and sends the outcome message to the originating Telegram chat or WhatsApp chat via WAHA.

Setup

  1. Create the n8n Data Table named “Receipt Expense Requests” with the required columns (as described in the template’s setup guide) and ensure matching is configured on requestKey.
  2. Add credentials for Telegram Bot API, Slack, OpenAI, and a Xero OAuth2 connection with access to Invoices, Contacts, Accounts, and TaxRates for the target tenant.
  3. Deploy and configure WAHA and n8n’s HTTP Header Auth credentials for WAHA, then set the webhook URL in WAHA and provide the shared HMAC secret used to sign requests.
  4. Update the workflow configuration values for Xero tenant ID, Slack channel ID, Slack approver member IDs, WAHA base URL/session name, and the allowed requester IDs for Telegram and WhatsApp.
  5. Confirm your Xero organisation has active expense accounts and purchase tax rates that match your receipts, and keep receipts within the configured limits (USD-only by default, max total 1,000, and max image size 3 MB).

Additional info

Connect with us:
Website: https://www.intuz.com/n8n-workflow-automation-templates/
Email: [email protected]
LinkedIn: https://www.linkedin.com/company/intuz

For Custom Workflow Automation

Get Started: https://n8n.partnerlinks.io/intuz