Quick overview
This workflow answers finance questions received on WhatsApp (via WAHA) or Telegram by fetching data from Xero, drafting a validated response with OpenAI, optionally posting the result to Slack, and persisting conversation state in an n8n Data Table.
How it works
- Receives an incoming message from WhatsApp via a WAHA webhook (with HMAC verification) or from a Telegram bot trigger.
- Normalizes the incoming message into a consistent format, applies workflow configuration, and blocks unauthorized senders based on an allowed-users list.
- Loads the prior conversation state from an n8n Data Table and decides whether the message is a Slack-share follow-up (Yes/No/post) or a new finance request.
- For new requests, uses OpenAI to classify the intent (accounts receivable, cash position, or bills due this week) and replies with help text if the intent is unknown.
- Retrieves the connected Xero organisations, selects the correct Xero tenant, and queries the relevant Xero endpoints to build a canonical text summary for the requested report.
- Uses OpenAI to rewrite the canonical Xero summary as a concise chat response and validates it against the canonical numbers before asking whether to post the update to Slack.
- Saves the updated conversation state and sends the reply back to the originating channel (WhatsApp via WAHA or Telegram), posting the previous answer to Slack if the user confirms.
Setup
- Connect credentials for Xero OAuth2, OpenAI, Slack, and Telegram, and add HTTP Header Auth credentials for the WAHA send API.
- Configure WAHA to send message events to the workflow’s webhook URL and set the matching HMAC SHA-512 secret and WAHA base URL.
- Create an n8n Data Table named “Finance Bot Conversation State” with columns for stateKey, userId, channel, chatId, lastIntent, lastResponse, and pendingSlackConfirmation.
- Update the workflow configuration values for allowed users, the Slack channel ID, and (if you have multiple Xero organisations) the Xero tenant ID.
Additional info
Connect with us:
Website: https://www.intuz.com/n8n-workflow-automation-templates/
Email: [email protected]
LinkedIn: https://www.linkedin.com/company/intuz
Get Started: https://n8n.partnerlinks.io/intuz
For Custom Worflow Automation
https://www.intuz.com/get-started/