# Build a Telegram AI assistant with MemMachine and OpenAI: n8n workflow

> Started by an incoming Telegram message, and works across Gmail, Google Calendar, Google Sheets and Telegram. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/build-a-telegram-ai-assistant-with-memmachine-and-openai (Millionrounds; every figure on the page links to its filing or article)

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

# Build a Telegram AI assistant with MemMachine and OpenAI

Started by an incoming Telegram message, and works across Gmail, Google Calendar, Google Sheets and Telegram. It hands the judgement calls to OpenAI. 21 steps, 1 branch: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-a-telegram-ai-assistant-with-memmachine-and-openai)

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

**1** Branch: places the flow splits

**0** Loops or waits

**4** Services it connects to

## The flow

Starts it 2 Model 4 Logic 7 Service 8

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

- 1 **1. Telegram Trigger** Telegram trigger *Starts it*
- 2 **Gmail Tool** Gmail Tool *Service*
- 3 **Google Sheets Tool** Google Sheets Tool *Service*
- 4 **Google Calendar Tool** Google Calendar Tool *Service*
- 5 **MCP Client** Mcp Client Tool *Model*
- 6 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 7 **2. Message Type** Switch *Logic*
- 8 **MCP Server Trigger** Mcp trigger *Starts it*
- 9 **7. AI Agent** Agent *Model*
- 10 **3a. Download Voice** Telegram *Service*
- 11 **3d. Extract Text Data** Set *Logic*
- 12 **8. Extract Response** Set *Logic*
- 13 **3b. Transcribe Voice** Open Ai *Model*
- 14 **Unifier** Code *Logic*
- 15 **8b. Prepare for Storage** Code *Logic*
- 16 **3c. Extract Voice Data** Set *Logic*
- 17 **4. Store User Query** Http Request *Service*
- 18 **9. Store AI Response** Http Request *Service*
- 19 **5. Search Memory** Http Request *Service*
- 20 **10. Send Response** Telegram *Service*
- 21 **6. Format Memory** Code *Logic*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 21, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Calendar, Google Sheets, Telegram
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Calendar, 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. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 21 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 21 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%2Fbuild-a-telegram-ai-assistant-with-memmachine-and-openai)
- **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.

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

## Workflows like it

Also customer support, with the same services where possible, closest in size first.

- [**Answer HR and IT policy questions on Telegram with OpenAI** 21 steps · calls a model · Telegram](https://millionrounds.com/workflow/answer-hr-and-it-policy-questions-on-telegram-with-openai)
- [**Automate multi-channel customer support with Gmail** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automate-multi-channel-customer-support-with-gmail)
- [**Automate support QA reviews with Intercom and OpenAI** 21 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/automate-support-qa-reviews-with-intercom-and-openai)
- [**Generate GEO-optimized support replies from Gmail** 21 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/generate-geo-optimized-support-replies-from-gmail)
- [**HR & IT helpdesk chatbot with OpenAI and Telegram** 21 steps · calls a model · Telegram](https://millionrounds.com/workflow/hr-and-it-helpdesk-chatbot-with-openai-and-telegram)
- [**Run a customer support RAG chatbot with OpenAI** 21 steps · calls a model · Google Drive, Telegram](https://millionrounds.com/workflow/run-a-customer-support-rag-chatbot-with-openai)
