# Categorize emails & get Telegram alerts with Azure OpenAI: n8n workflow

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

Source: https://millionrounds.com/workflow/categorize-emails-and-get-telegram-alerts-with-azure-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# Categorize emails & get Telegram alerts with Azure OpenAI

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

Large Calls a model: Azure OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcategorize-emails-and-get-telegram-alerts-with-azure-openai)

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

**1** Branch: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 1 Model 5 Logic 7 Service 10

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

- 1 **Email Trigger (IMAP)** Email Read Imap *Service*
- 2 **Telegram Trigger** Telegram trigger *Starts it*
- 3 **Azure OpenAI Agent** Lm Chat Azure Open Ai *Model*
- 4 **Azure OpenAI Classifier** Lm Chat Azure Open Ai *Model*
- 5 **Memory** Memory Buffer Window *Model*
- 6 **Update Status** Google Sheets Tool *Service*
- 7 **Get User ID** Google Sheets *Service*
- 8 **Get E-Mails** Google Sheets *Service*
- 9 **Append User ID** Google Sheets *Service*
- 10 **AI Agent** Agent *Model*
- 11 **E-Mail Text Classifier** Text Classifier *Model*
- 12 **Mail Information** Set *Logic*
- 13 **Aggregate** Aggregate *Logic*
- 14 **Reply To User** Telegram *Service*
- 15 **Send Security Message** Telegram *Service*
- 16 **Send Personal Message** Telegram *Service*
- 17 **Send Reply Message** Telegram *Service*
- 18 **Like im young again** No Op *Logic*
- 19 **Nothing will change** No Op *Logic*
- 20 **If Null** If *Logic*
- 21 **Set Rows as Data** Set *Logic*
- 22 **Append Mail Details** Google Sheets *Service*
- 23 **Nothing** No Op *Logic*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 23, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Email, Google Sheets, Telegram
- **Model:** Azure 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 Email, Google Sheets and Telegram accounts, and a key for Azure 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 Azure 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 23 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 23 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%2Fcategorize-emails-and-get-telegram-alerts-with-azure-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.

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

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Automate Reddit replies with F5Bot and OpenAI** 23 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automate-reddit-replies-with-f5bot-and-openai)
- [**Daily AI research summary from arXiv with Gemini and Notion** 23 steps · calls a model · Notion, Telegram](https://millionrounds.com/workflow/daily-ai-research-summary-from-arxiv-with-gemini-and-notion)
- [**Detect and correct claims cost leakage with OpenAI** 23 steps · calls a model · Email, Postgres](https://millionrounds.com/workflow/detect-and-correct-claims-cost-leakage-with-openai)
- [**Monitor AI budgets and optimize costs with Claude and Slack** 23 steps · calls a model · Email, Slack](https://millionrounds.com/workflow/monitor-ai-budgets-and-optimize-costs-with-claude-and-slack)
- [**Monitor Lis Pendens real estate filings with Telegram** 23 steps · calls a model · Telegram](https://millionrounds.com/workflow/monitor-lis-pendens-real-estate-filings-with-telegram)
- [**Monitor attack surface changes with OpenAI and Postgres** 23 steps · calls a model · Email, Postgres](https://millionrounds.com/workflow/monitor-attack-surface-changes-with-openai-and-postgres)
