This n8n workflow enables a robust chatbot experience through Telegram, designed to handle multiple quick succession messages from users seamlessly. The core idea is to buffer short messages sent in rapid succession, combine them, and then generate a unified AI-powered response. The workflow starts by receiving messages via a Telegram webhook and temporarily storing each message in a Supabase PostgreSQL table, effectively queuing the messages. After a configurable interval (default 10 seconds), the system checks the queue, aggregates all messages from a user, and processes them collectively with an OpenAI GPT-4 model. The AI’s response is delivered back to the user in a single message, providing a smooth conversational flow. Additionally, the workflow manages the message queue to prevent repetition, deletes processed messages from the database, and maintains conversation history in Postgres for context-aware interactions. This setup is ideal for creating smart, user-friendly chatbots capable of handling multi-message interactions effortlessly in platforms like Telegram and beyond.
Telegram Buffering Chatbot with AI and Database Integration
Node Count | >20 Nodes |
---|---|
Nodes Used | @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmChatOpenAi, @n8n/n8n-nodes-langchain.memoryPostgresChat, aggregate, if, noOp, sort, stickyNote, supabase, telegram, telegramTrigger, wait |
Reviews
There are no reviews yet.