# AI advanced automation agent with Azure OpenAI and Gmail: n8n workflow

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

Source: https://millionrounds.com/workflow/ai-advanced-automation-agent-with-azure-openai-and-gmail (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)

# AI advanced automation agent with Azure OpenAI and Gmail

Started by an incoming Telegram message, and works across Gmail and Telegram. It puts Azure OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 45 steps, 4 branches: 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%2Fai-advanced-automation-agent-with-azure-openai-and-gmail)

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

**4** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 4 Model 9 Logic 10 Service 22

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

- 1 **Azure OpenAI Chat Model** Lm Chat Azure Open Ai *Model*
- 2 **Firecrwal scrape list tools** Mcp Client Tool *Service*
- 3 **Firecrawl scrape execute** Mcp Client Tool *Service*
- 4 **Brave search list tools** Mcp Client Tool *Service*
- 5 **Github tool list** Mcp Client Tool *Service*
- 6 **Github tools execute** Mcp Client Tool *Service*
- 7 **Brave tool execute** Mcp Client Tool *Service*
- 8 **Telegram Trigger** Telegram trigger *Starts it*
- 9 **Tweet on Twitter** Twitter Tool *Service*
- 10 **Delete A tweet** Twitter Tool *Service*
- 11 **Simple Memory** Memory Buffer Window *Model*
- 12 **Webhook** Webhook *Starts it*
- 13 **Deep Research** Tool Http Request *Model*
- 14 **Translator tool** Tool Http Request *Model*
- 15 **When Executed by Another Workflow** Execute Workflow trigger *Starts it*
- 16 **Send mail** Gmail Tool *Service*
- 17 **Get all mails** Gmail Tool *Service*
- 18 **Email Agent** Tool Workflow *Model*
- 19 **Webhook1** Webhook *Starts it*
- 20 **Image Genertion tool** Tool Http Request *Model*
- 21 **Youtube transcript and summerize** Tool Http Request *Model*
- 22 **AI Agent** Agent *Model*
- 23 **AI Agent1** Agent *Model*
- 24 **Switch** Switch *Logic*
- 25 **HTTP Request** Http Request *Service*
- 26 **Switch2** Switch *Logic*
- 27 **Telegram5** Telegram *Service*
- 28 **Code** Code *Logic*
- 29 **Telegram3** Telegram *Service*
- 30 **Error Response** Set *Logic*
- 31 **Code2** Code *Logic*
- 32 **If1** If *Logic*
- 33 **HTTP Request1** Http Request *Service*
- 34 **Telegram4** Telegram *Service*
- 35 **HTTP Request3** Http Request *Service*
- 36 **Telegram** Telegram *Service*
- 37 **Edit Fields** Set *Logic*
- 38 **Success Response** Set *Logic*
- 39 **Code1** Code *Logic*
- 40 **Telegram7** Telegram *Service*
- 41 **Telegram1** Telegram *Service*
- 42 **Telegram6** Telegram *Service*
- 43 **If** If *Logic*
- 44 **Telegram8** Telegram *Service*
- 45 **Telegram2** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 45, with 4 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, 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 Gmail 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 45 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 45 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%2Fai-advanced-automation-agent-with-azure-openai-and-gmail)
- **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)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

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

- [**Route ERP tasks across departments with OpenAI and Slack** 44 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/route-erp-tasks-across-departments-with-openai-and-slack)
- [**Telegram bot for crypto exchange trading with OKX** 46 steps · calls a model · Telegram](https://millionrounds.com/workflow/telegram-bot-for-crypto-exchange-trading-with-okx)
- [**Smart kitchen & inventory assistant with OpenAI** 43 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/smart-kitchen-and-inventory-assistant-with-openai)
- [**Attendance system with OpenAI and Google Sheets** 41 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/attendance-system-with-openai-and-google-sheets)
- [**Generate consensus-based answers with Claude and OpenAI** 41 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/generate-consensus-based-answers-with-claude-and-openai)
- [**Forex AI trading assistant for Telegram with Position Sizing** 40 steps · calls a model · Telegram](https://millionrounds.com/workflow/forex-ai-trading-assistant-for-telegram-with-position-sizing)
