# Process prescription orders and refills with Telegram: n8n workflow

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

Source: https://millionrounds.com/workflow/process-prescription-orders-and-refills-with-telegram (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [E-commerce](https://millionrounds.com/workflows?category=E-commerce#library)

# Process prescription orders and refills with Telegram

Started by an incoming Telegram message, and works across Google Sheets, Slack and Telegram. It hands the judgement calls to Gemini. 32 steps, 2 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fprocess-prescription-orders-and-refills-with-telegram)

**32 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 4 Model 1 Logic 10 Service 17

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

- 1 **Telegram Message Received** Telegram trigger *Starts it*
- 2 **Delivery Status Webhook** Webhook *Starts it*
- 3 **Daily Refill Check** Schedule trigger *Starts it*
- 4 **On Workflow Error** Error trigger *Starts it*
- 5 **Normalize Incoming Message** Code *Logic*
- 6 **Update Order Delivery Status** Google Sheets *Service*
- 7 **Get Orders Due For Refill** Google Sheets *Service*
- 8 **Slack – Post Workflow Error Alert** Slack *Service*
- 9 **Route By Message Type** Switch *Logic*
- 10 **Telegram - Send Delivery Update** Telegram *Service*
- 11 **Filter Due Today Or Earlier** Filter *Logic*
- 12 **Telegram - Download Photo** Telegram *Service*
- 13 **Get Last Order (Refill)** Google Sheets *Service*
- 14 **Get Latest Order (Status)** Google Sheets *Service*
- 15 **Get Pending Order (Confirm)** Google Sheets *Service*
- 16 **Loop Over Due Refills** Split In Batches *Logic*
- 17 **Analyze an image** Google Gemini *Model*
- 18 **Build Refill Order** Code *Logic*
- 19 **Telegram - Send Delivery Status** Telegram *Service*
- 20 **Update Order Status To Confirmed** Google Sheets *Service*
- 21 **Telegram - Send Refill Reminder** Telegram *Service*
- 22 **Parse OCR Result** Code *Logic*
- 23 **Create Order Record** Google Sheets *Service*
- 24 **Telegram - Send Order Confirmed** Telegram *Service*
- 25 **Mark Reminder Sent** Google Sheets *Service*
- 26 **Split Out Medicines** Split Out *Logic*
- 27 **Telegram - Send Order Summary** Telegram *Service*
- 28 **Lookup Medicine In Inventory** Google Sheets *Service*
- 29 **Check Stock Available** If *Logic*
- 30 **Update Inventory Stock** Google Sheets *Service*
- 31 **Aggregate Order Lines** Aggregate *Logic*
- 32 **Build Order Summary** Code *Logic*

## How it's built

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

## Questions

What does it need to run?

An n8n account, plus your own Google Sheets, Slack and Telegram accounts, and a key for Gemini. 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 Gemini. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 32 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 32 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%2Fprocess-prescription-orders-and-refills-with-telegram)
- **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)[Slack](https://millionrounds.com/workflows?service=Slack#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also e-commerce, with the same services where possible, closest in size first.

- [**Manage your WooCommerce store with OpenAI** 32 steps · calls a model · Discord, Gmail](https://millionrounds.com/workflow/manage-your-woocommerce-store-with-openai)
- [**Handle voice food orders with Google Sheets** 32 steps · Google Sheets](https://millionrounds.com/workflow/handle-voice-food-orders-with-google-sheets)
- [**Confirm COD orders and recover carts with Telegram** 33 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/confirm-cod-orders-and-recover-carts-with-telegram)
- [**Share Shopify New Products Across All Social Media Platforms** 29 steps · calls a model · Discord, Gmail](https://millionrounds.com/workflow/share-shopify-new-products-across-all-social-media-platforms)
- [**Generate UGC promo videos with OpenAI and Sora 2** 28 steps · calls a model · Telegram](https://millionrounds.com/workflow/generate-ugc-promo-videos-with-openai-and-sora-2)
- [**Review and approve Google Sheets orders by email and notify** 28 steps · Gmail, Google Sheets](https://millionrounds.com/workflow/review-and-approve-google-sheets-orders-by-email-and-notify)
