Create a session-based Telegram chatbot with GPT-4o-mini and Google Sheets
How It Works This workflow creates an AI-powered Telegram chatbot with session management, allowing users to: - Start new conversations (/new). - Check current sessions (/current). - Resume past sessions (/resume). - ...
Template notes
How It Works This workflow creates an AI-powered Telegram chatbot with session management, allowing users to: - Start new conversations (/new). - Check current sessions (/current). - Resume past sessions (/resume). - Get summaries (/summary). - Ask questions (/question).
Key Components: - Session Management: - Uses Google Sheets to track active/expired sessions (storing SESSION IDs and STATE). - /new creates a session; /resume reactivates past ones. - AI Processing: - OpenAI GPT-4 generates responses with contextual memory (via Simple Memory node). - Summarization: Condenses past conversations when requested. - Data Logging: - All interactions (prompts/responses) are saved to Google Sheets for audit and retrieval. - User Interaction: - Telegram commands trigger specific actions (e.g., /question [query] fetches answers from session history).
---
Main Advantages
1. Multi-session Handling Each user can create, manage, and switch between multiple sessions independently, perfect for organizing different conversations without confusion.
2. Persistent Memory Conversations are stored in Google Sheets, ensuring that chat history and session states are preserved even if the server or n8n instance restarts.
3. Commands for Full Control With intuitive commands like /new, /current, /resume, /summary, and /question, users can manage sessions easily without needing a web interface.
4. Smart Summarization and Q&A Thanks to OpenAI models, the workflow can summarize entire conversations or answer specific questions about past discussions, saving time and improving the chatbot’s usability.