# Assist hospital doctors with Telegram and OpenAI: n8n workflow

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

Source: https://millionrounds.com/workflow/assist-hospital-doctors-with-telegram-and-openai (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)

# Assist hospital doctors with Telegram and OpenAI

Started by an incoming Telegram message, and works across Gmail, Google Sheets, Slack and Telegram. It hands the judgement calls to OpenAI. 34 steps, 4 branches, 1 loop or waits: 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%2Fassist-hospital-doctors-with-telegram-and-openai)

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

**4** Branches: places the flow splits

**1** Loop or waits

**4** Services it connects to

## The flow

Starts it 4 Model 4 Logic 9 Service 17

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

- 1 **Schedule - Daily Follow-up Check** Schedule trigger *Starts it*
- 2 **Telegram Trigger - Doctor Message** Telegram trigger *Starts it*
- 3 **Webhook - Update Bed Count** Webhook *Starts it*
- 4 **On Workflow Error** Error trigger *Starts it*
- 5 **Sheets - Get All Patients** Google Sheets *Service*
- 6 **IF - Has Report Document** If *Logic*
- 7 **Sheets - Update Bed Row** Google Sheets *Service*
- 8 **Slack – Post Workflow Error Alert** Slack *Service*
- 9 **Filter - Due For Follow-up Today** Filter *Logic*
- 10 **Telegram - Download Report File** Telegram *Service*
- 11 **IF - Is Discharge Command** If *Logic*
- 12 **Loop - Over Due Patients** Split In Batches *Logic*
- 13 **Extract - Report Text** Extract From File *Service*
- 14 **Set - Extract Patient ID (Discharge)** Set *Logic*
- 15 **IF - Is Labs Command** If *Logic*
- 16 **Telegram - Send Follow-up Message** Telegram *Service*
- 17 **AI - Summarize Report** Open Ai *Model*
- 18 **Sheets - Get Patient Record** Google Sheets *Service*
- 19 **Set - Extract Lab Values Text** Set *Logic*
- 20 **IF - Is Beds Command** If *Logic*
- 21 **Sheets - Mark Follow-up Sent** Google Sheets *Service*
- 22 **Sheets - Log Report Summary** Google Sheets *Service*
- 23 **AI - Generate Discharge Summary** Open Ai *Model*
- 24 **AI - Analyze Lab Values** Open Ai *Model*
- 25 **Sheets - Read Bed Availability** Google Sheets *Service*
- 26 **AI - Doctor Assistant Chat** Open Ai *Model*
- 27 **Telegram - Send Report Summary** Telegram *Service*
- 28 **Sheets - Save Discharge Summary** Google Sheets *Service*
- 29 **Telegram - Send Lab Analysis** Telegram *Service*
- 30 **Code - Format Bed Availability** Code *Logic*
- 31 **Telegram - Send Assistant Reply** Telegram *Service*
- 32 **Gmail - Email Discharge Summary** Gmail *Service*
- 33 **Telegram - Send Bed Availability** Telegram *Service*
- 34 **Telegram - Confirm Discharge Sent** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 34, with 4 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Sheets, Slack, Telegram
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Sheets, Slack 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 34 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 34 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%2Fassist-hospital-doctors-with-telegram-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 Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Slack](https://millionrounds.com/workflows?service=Slack#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.

- [**Classify and auto-reply to Gmail with OpenAI** 34 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/classify-and-auto-reply-to-gmail-with-openai)
- [**Email management system with OpenAI and Pinecone DB** 34 steps · calls a model · Gmail, Pinecone](https://millionrounds.com/workflow/email-management-system-with-openai-and-pinecone-db)
- [**Evaluate job fit and generate application assets** 34 steps · calls a model · Apify, Gmail](https://millionrounds.com/workflow/evaluate-job-fit-and-generate-application-assets)
- [**Guard releases and investigate regressions with Browserbase** 34 steps · calls a model · Email, GitHub](https://millionrounds.com/workflow/guard-releases-and-investigate-regressions-with-browserbase)
- [**Manage rent, maintenance and tenant messages with OpenAI** 34 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/manage-rent-maintenance-and-tenant-messages-with-openai)
- [**AI powered RAG chatbot for your docs + Google Drive + Gemini** 35 steps · calls a model · Google Docs, Google Drive](https://millionrounds.com/workflow/ai-powered-rag-chatbot-for-your-docs-google-drive-gemini)
