Route rental payment and receipt messages with Telegram and OpenAI GPT-4.1
Quick overview This demo workflow listens for Telegram rental messages, routes receipt-related commands, uses OpenAI to classify payments, costs, and booking summaries, then replies with parsed details and a sample receipt flow.
How it works Triggers when a new Telegram message is received. Routes the message into one of four paths: full /receipt command, receipt request, receipt date reply, or general rental tracking. If a full /receipt command is provided, it parses client, property, stay dates, amount, and transaction details and replies in Telegram with the extracted fields. If the user sends a receipt request, it looks up the last saved payment for that Telegram chat and either prompts the user for stay dates or returns an error if no payment is stored. If the user replies with stay dates during a pending receipt flow, it combines those dates with the stored payment to build receipt details and replies with either a “ready to generate” summary or an error message. For all other messages, it sends the text to OpenAI to classify it as payment, cost, or booking summary, normalizes the JSON result, and replies in Telegram with the parsed output. When a payment is detected, it extracts basic M-Pesa fields from the SMS text and stores the last payment per chat to support the receipt request flow.
Setup Add a Telegram Bot credential in n8n and connect it to the Telegram Trigger and Telegram send-message steps. Add an OpenAI credential for the OpenAI model step used to classify rental messages. Update the OpenAI model selection and system prompt rules to match your property names, currency, country, and payment-message format. Test the receipt flow by sending a payment SMS, replying "receipt", and then sending stay dates such as "24 Jun 2026 to 28 Jun 2026".
Customization For production use, replace the demo Telegram replies with HTTP Request nodes connected to your Google Sheet, Apps Script, database, CRM, or receipt generator backend.
Related Templates
AI SEO Readability Audit: Check Website Friendliness for LLMs
Who is this for? This workflow is designed for SEO specialists, content creators, marketers, and website developers who ...
Text automations using Apple Shortcuts
Overview This workflow answers user requests sent via Mac Shortcuts Several Shortcuts call the same webhook, with a quer...
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments