Templates / Create a session-based Telegram chatbot with GPT-4o-mini and Google Sheets

Create a session-based Telegram chatbot with GPT-4o-mini and Google Sheets

Needs changes

by Davide Boizza ✓ · 14,095 views · created 2025-04-30 · Support Chatbot, AI Chatbot

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 31 nodes and runs on Telegram events (message). Along the way it connects OpenAI Chat Model, Telegram and Google Sheets.

How it runs

Trigger: On Telegram events (message).

  1. Get session (Google Sheets): uses Google Sheets
  2. Command or text? (Switch): routes items into 5 branches
  3. Disable previous session (Google Sheets): update
  4. Send current session (Telegram): uses Telegram
  5. Get message (Edit Fields (Set)): sets 1 field: text
  6. Get session (Google Sheets): uses Google Sheets
  7. Get message (Edit Fields (Set)): sets 1 field: text
  8. Telegram Chatbot (AI Agent): runs an AI agent, with model: OpenAI Chat Model; memory: Simple Memory
  9. Set new session (Google Sheets): append
  10. Trim resume (Code): runs custom JavaScript code

…plus 16 more steps. See the full node list below.

Services it uses

OpenAI Chat ModelTelegramGoogle Sheets

Before you upgrade to n8n 3.0

1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:

  • AI Agent v1 (old agent modes) in Telegram Chatbot (v1.9): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).

Removed in 3.0Replace with
AI Agent v1 (old agent modes)
Telegram Chatbot (v1.9)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (12)

From the author

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…

Excerpt from Davide Boizza's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.