AI-Powered Telegram Chatbot with Persistent Memory
detail.loadingPreview
Deploy an intelligent AI chatbot directly within Telegram that remembers past conversations. This workflow leverages OpenAI's Assistants API for sophisticated responses and Supabase for persistent chat history, offering personalized interactions.
About This Workflow
This n8n workflow empowers you to build a dynamic Telegram chatbot with a robust memory, powered by OpenAI's Assistants API. Upon receiving a Telegram message, the workflow intelligently checks if the user is new. For first-time users, it automatically provisions a dedicated OpenAI thread and securely stores their chat context in a Supabase database. Returning users seamlessly resume their ongoing conversations, with their history retrieved from Supabase. The user's message is then sent to the specified OpenAI Assistant for processing, which generates a tailored response. Finally, the AI's answer is delivered back to the user in Telegram, ensuring a continuous and context-aware conversational experience.
Key Features
- Persistent Chat History: Each user maintains a dedicated conversation thread with OpenAI, ensuring the AI remembers past interactions.
- Automated User Provisioning: New users automatically get an OpenAI thread created and their chat context stored in Supabase.
- Intelligent AI Responses: Harness the power of OpenAI's Assistants API to generate contextually relevant and helpful replies.
- Seamless Telegram Integration: Engage with your AI assistant directly within the familiar Telegram messaging environment.
- Scalable Data Storage: Utilize Supabase to reliably store user and thread IDs, making the chatbot scalable for many users.
How To Use
- Configure Telegram Trigger: Set up the
Get New Messagenode with your Telegram Bot Token to receive incoming messages. - Set Up OpenAI Credentials: Provide your OpenAI API Key for all
httpRequestnodes interacting with the OpenAI API. - Specify OpenAI Assistant ID: Update the
assistant_idparameter in theOPENAI - Run assistantnode with the ID of your pre-configured OpenAI Assistant. - Connect Supabase Database: Configure the
Find UserandCreate Usernodes with your Supabase API credentials. Ensure a table namedtelegram_usersexists, containing columns fortelegram_id(TEXT) andopenai_thread_id(TEXT). - Activate Workflow: Once all connections and configurations are complete, activate the workflow to enable your AI-powered Telegram chatbot.
Apps Used
Workflow JSON
{
"id": "c9e6488b-5831-4404-8f08-5b65bce6b367",
"name": "AI-Powered Telegram Chatbot with Persistent Memory",
"nodes": 26,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: c9e6488b-5831...
About the Author
Crypto_Watcher
Web3 Developer
Automated trading bots and blockchain monitoring workflows.
Statistics
Related Workflows
Discover more workflows you might like
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.