# Telegram bot starter template setup & AI agent chatbot: n8n workflow

> Started by an incoming Telegram message, and works across Google Sheets and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from...

Source: https://millionrounds.com/workflow/telegram-bot-starter-template-setup-and-ai-agent-chatbot (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Chat assistants](https://millionrounds.com/workflows?category=Chat+assistants#library)

# Telegram bot starter template setup & AI agent chatbot

Started by an incoming Telegram message, and works across Google Sheets and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 29 steps, 6 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftelegram-bot-starter-template-setup-and-ai-agent-chatbot)

**29 steps** Large: read it before trusting it with anything live

**6** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 7 Logic 14 Service 7

The steps in the order they run, from what starts it.

- 1 **Trigger** Telegram trigger *Starts it*
- 2 **TextDataExample** Set *Logic*
- 3 **Agent: Find in the Internet** Tool Workflow *Model*
- 4 **Simple Memory** Memory Buffer Window *Model*
- 5 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 6 **Agent: Check Order Status** Tool Workflow *Model*
- 7 **Agent: Search Internal Docs** Tool Workflow *Model*
- 8 **Agent: Calculate Cost or Quote** Tool Workflow *Model*
- 9 **Global data** Set *Logic*
- 10 **AI Agent** Agent *Model*
- 11 **Switch** Switch *Logic*
- 12 **Telegram4** Telegram *Service*
- 13 **Switch_MessageType** Switch *Logic*
- 14 **Telegram3** Telegram *Service*
- 15 **Start bot?** If *Logic*
- 16 **Trigger Data for Payment** Set *Logic*
- 17 **Command?** If *Logic*
- 18 **Telegram1** Telegram *Service*
- 19 **Telegram2** Telegram *Service*
- 20 **Telegram5** Telegram *Service*
- 21 **Menu** Switch *Logic*
- 22 **Trigger Data for Register** Set *Logic*
- 23 **Change status** Google Sheets *Service*
- 24 **Payment Handler** Execute Workflow *Logic*
- 25 **Switch_Commands** Switch *Logic*
- 26 **Register** Execute Workflow *Logic*
- 27 **Data for Invoice** Set *Logic*
- 28 **Telegram6** Telegram *Service*
- 29 **Send Invoice** Execute Workflow *Logic*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 29, with 6 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Sheets, Telegram
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Google Sheets and Telegram accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 29 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 29 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftelegram-bot-starter-template-setup-and-ai-agent-chatbot)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also chat assistants, with the same services where possible, closest in size first.

- [**Basic RAG system with Claude and OpenAI** 29 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/basic-rag-system-with-claude-and-openai)
- [**Build a Telegram AI chatbot with Trilox and OpenAI** 29 steps · calls a model · Telegram](https://millionrounds.com/workflow/build-a-telegram-ai-chatbot-with-trilox-and-openai)
- [**Find and rank job listings from Adzuna and Remotive** 29 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/find-and-rank-job-listings-from-adzuna-and-remotive)
- [**Get Colombian peso to USD exchange rate with Telegram** 29 steps · calls a model · Telegram](https://millionrounds.com/workflow/get-colombian-peso-to-usd-exchange-rate-with-telegram)
- [**Score GeM tender compliance and draft bid responses** 29 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/score-gem-tender-compliance-and-draft-bid-responses)
- [**Triage product UAT feedback with OpenAI and Jira** 29 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/triage-product-uat-feedback-with-openai-and-jira)
