# Telegram chatbot with OpenAI: n8n workflow template

> Started by an incoming Telegram message, and works across Google Sheets, Supabase vectors and Telegram.

Source: https://millionrounds.com/workflow/telegram-chatbot-with-openai-2 (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 chatbot with OpenAI

Started by an incoming Telegram message, and works across Google Sheets, Supabase vectors and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 26 steps, 2 branches, 1 loop or waits: 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-chatbot-with-openai-2)

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

**2** Branches: places the flow splits

**1** Loop or waits

**3** Services it connects to

## The flow

Starts it 1 Model 6 Logic 10 Service 9

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

- 1 **Embeddings OpenAI1** Embeddings Open Ai *Model*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **Simple Memory** Memory Buffer Window *Model*
- 4 **Telegram Trigger** Telegram trigger *Starts it*
- 5 **Supabase Vector Store** Vector Store Supabase *Model*
- 6 **AI Agent** Agent *Model*
- 7 **Link Filter** If *Logic*
- 8 **Send message Back to TG** Telegram *Service*
- 9 **Get Audio File** Telegram *Service*
- 10 **Pass text message** Set *Logic*
- 11 **Delete Row from Message Checkup** Google Sheets *Service*
- 12 **Transcribe a recording** Open Ai *Model*
- 13 **Merge** Merge *Logic*
- 14 **Transcript Result** Set *Logic*
- 15 **Transcript Error Output** Set *Logic*
- 16 **Edit Fields** Set *Logic*
- 17 **Append row in sheet** Google Sheets *Service*
- 18 **Get row(s) in sheet1** Google Sheets *Service*
- 19 **No Rows** Code *Logic*
- 20 **What to do** If *Logic*
- 21 **Update row in sheet** Google Sheets *Service*
- 22 **Update row in sheet1** Google Sheets *Service*
- 23 **Wait** Wait *Logic*
- 24 **Get row(s) in sheet** Google Sheets *Service*
- 25 **Batch Messages** Code *Logic*
- 26 **Delete rows or columns from sheet1** Google Sheets *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 26, with 2 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Sheets, Supabase vectors, 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, Supabase vectors 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 26 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 26 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-chatbot-with-openai-2)
- **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)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#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.

- [**AI-powered credit card recommendation system with OpenAI** 26 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/ai-powered-credit-card-recommendation-system-with-openai)
- [**Create personalized news digests with OpenAI and SerpAPI** 26 steps · calls a model · Telegram, n8n data table](https://millionrounds.com/workflow/create-personalized-news-digests-with-openai-and-serpapi)
- [**Generate move-out deposit statements with Gmail** 26 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/generate-move-out-deposit-statements-with-gmail)
- [**Manage dental patients with Telegram and OpenAI** 26 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/manage-dental-patients-with-telegram-and-openai)
- [**Smart email manager with Gmail and OpenAI** 26 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/smart-email-manager-with-gmail-and-openai)
- [**Telegram personal AI agent with Gemini and Airtable** 26 steps · calls a model · Airtable, Telegram](https://millionrounds.com/workflow/telegram-personal-ai-agent-with-gemini-and-airtable)
