Telegram AI assistant with rate limiting and auto-reset using Google Sheets
Needs changesWhat this workflow does
This AI workflow has 15 nodes and runs on Telegram events (message) (plus 1 other trigger). Along the way it connects Google Sheets, Azure OpenAI Chat Model and Telegram.
How it runs
Trigger: On Telegram events (message) (plus 1 other trigger).
- Append or update row in sheet (Google Sheets): append or update
- Get row(s) in sheet (Google Sheets): uses Google Sheets
- Get row(s) in sheet (Google Sheets): uses Google Sheets
- Update row in sheet (Google Sheets): update
- Code: runs custom JavaScript code
- Append or update row in sheet (Google Sheets): append or update
- Switch: routes items into 3 branches
- Limit Message (Telegram): uses Telegram
- Agent (AI Agent): runs an AI agent, with model: Azure; memory: Memory
- Agent Answer (Telegram): uses Telegram
Services it uses
Other Telegram + Google Sheets templates (674) · Other Google Sheets + Azure OpenAI templates (88) · Other Telegram + Azure OpenAI templates (15)
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 Agent (v1.7): 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).
Published 2025 — 19% of 2025 templates need changes for 3.0. See how template age affects 3.0 readiness →
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) Agent (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (10)
- AI Agent
@n8n/n8n-nodes-langchain.agent - Code
n8n-nodes-base.code - Google Sheets
n8n-nodes-base.googleSheets - Azure OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatAzureOpenAi - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Switch
n8n-nodes-base.switch - No Operation, do nothing
n8n-nodes-base.noOp - Telegram
n8n-nodes-base.telegram - Telegram Trigger
n8n-nodes-base.telegramTrigger - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
From the author
Production-ready solution for controlling AI agent usage and preventing abuse while managing costs. 🎯 Problem Solved Unlimited AI interactions → Excessive API costs Service abuse → Uncontrolled resource consumption No built-in limits → Need for usage quotas…