A robust n8n workflow utilizing a Telegram trigger to implement an interactive multi-select checkbox module, saving choices and status updates directly to a Postgres database. Download these advanced n8n templates.
Download this n8n workflow template and start using it instantly.
Managing persistent state and interactive elements like multi-select checkboxes in chat applications can be challenging. This specific n8n workflow solves this by tightly integrating a Telegram bot with a Postgres database, allowing users to interactively select items from a list, much like a shopping cart or a survey form, and instantly updating the choices visible via an inline keyboard. Every selection is recorded immediately in Postgres, ensuring data integrity and enabling dynamic feedback. This advanced n8n workflow demonstrates powerful use of the n8n node ecosystem, particularly utilizing the n8n trigger for immediate response and custom code for UI rendering. This solution is ideal for building custom ordering systems or sophisticated data capture tools within Telegram.
The entire process begins when a user interacts with the bot, activating the Telegram Trigger n8n trigger.
Variables TG and Initialization set n8n nodes, defining necessary variables for user and chat IDs. Start? if n8n node checks if the user initiated the flow. If true, a Welcome Message is sent, and the user's bot status is recorded in Postgres using the Upsert bot status on START n8n node.Define Type switch n8n node routes the input. If it’s a new order (New?), the process creates a new order record in Postgres (Add Order), fetches the available Shop List items, and adds the initial choices (Add Shop List Choice).Convert statuses code n8n node takes the database data, formats it into a list with checkbox statuses, and sends the interactive message via the Send Telegram n8n node, logging the message ID for later edits.Switch and subsequent Postgres lookups (Get Order, Get messageid). The core selection logic happens when the flow uses the message ID to Update Shop List Choice in Postgres. It then fetches the new choices (Get Shop List Choice).Convert statuses and antistatuses code n8n node processes the updated selection list, generating a new inline keyboard layout. The Edit Telegram n8n node then replaces the previous message content and keyboard, giving the user instant feedback without flooding the chat with new messages. This message ID is updated in Postgres (Update messageid ).Answers switch n8n node), the final chosen items are fetched from Postgres, summarized (Union List), and the previous messages are deleted (Delete Prev SMS). A final Results message is sent confirming the order, completing this comprehensive n8n workflow.To deploy this powerful n8n workflow, follow these steps:
Telegram Trigger, Send, Edit, etc.). Ensure your bot is created via BotFather.messageid, chatid, and item status).Telegram Trigger n8n trigger is active. It will listen for incoming messages and callbacks from your configured Telegram bot.Code n8n nodes (Convert statuses) to ensure the logic aligns with how your specific item data is structured and how you wish the inline keyboard buttons to be generated. Telegram Trigger (n8n trigger): The entry point of the n8n workflow, activated by incoming messages or callback queries from the Telegram bot.
Postgres Node (Multiple Instances): Essential for state management. Nodes like Add Order, Get Shop List, Update Shop List Choice, and Update message_id handle the persistence of user choices, order status, and message IDs for dynamic message editing.
Set Node (Variables TG, Initialization): Used to define and map crucial data elements like chat IDs and user information at the start of the n8n workflow execution.
If Node (Start?, New?, Active?): Manages flow control, determining if a command is a fresh start, a new order, or a status update.
Switch Node (Define Type, Switch, Answers): Critical control flow n8n node for routing callback queries based on the data sent via the inline keyboard buttons, ensuring the correct logic path is executed (e.g., selection vs. final submission).
Code Node (Convert statuses): A custom n8n node used to dynamically generate the complex structure required for the Telegram inline keyboard. It reads the current selections from Postgres and formats the buttons (e.g., [x] Item A, [ ] Item B) based on the database status.
Automate email drafting and inbox management using voice commands via Telegram. This powerful n8n workflow integrates OpenAI, Telegram, and Gmail for seamless productivity.

Automate user registration for Telegram groups or bots. This n8n workflow uses Google Sheets as a database to check for existing users and send personalized welcome messages using the Telegram n8n node.

Use this powerful n8n workflow to build a smart Telegram assistant that performs real-time Amazon product searches using Apify scraping and OpenRouter AI intent detection. Highly flexible n8n templates.

Use this comprehensive n8n workflow to create a Retrieval-Augmented Generation (RAG) chatbot on Telegram. Index PDFs into Pinecone and answer queries using Groq LLMs.

Use this robust n8n workflow to automate Telegram channel giveaways. It handles user enrollment, database state management, random winner selection, and database cleanup using multiple n8n node configurations.


Analyst-Developer







































