Automation library · E-commerce

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.

LargeCalls a model: Gemini

32 stepsLarge: read it before trusting it with anything live
2Branches: places the flow splits
1Loop or waits
3Services it connects to

The flow

Starts it 4Model 1Logic 10Service 17

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

  1. 1Telegram Message ReceivedTelegram triggerStarts it
  2. 2Delivery Status WebhookWebhookStarts it
  3. 3Daily Refill CheckSchedule triggerStarts it
  4. 4On Workflow ErrorError triggerStarts it
  5. 5Normalize Incoming MessageCodeLogic
  6. 6Update Order Delivery StatusGoogle SheetsService
  7. 7Get Orders Due For RefillGoogle SheetsService
  8. 8Slack – Post Workflow Error AlertSlackService
  9. 9Route By Message TypeSwitchLogic
  10. 10Telegram - Send Delivery UpdateTelegramService
  11. 11Filter Due Today Or EarlierFilterLogic
  12. 12Telegram - Download PhotoTelegramService
  13. 13Get Last Order (Refill)Google SheetsService
  14. 14Get Latest Order (Status)Google SheetsService
  15. 15Get Pending Order (Confirm)Google SheetsService
  16. 16Loop Over Due RefillsSplit In BatchesLogic
  17. 17Analyze an imageGoogle GeminiModel
  18. 18Build Refill OrderCodeLogic
  19. 19Telegram - Send Delivery StatusTelegramService
  20. 20Update Order Status To ConfirmedGoogle SheetsService
  21. 21Telegram - Send Refill ReminderTelegramService
  22. 22Parse OCR ResultCodeLogic
  23. 23Create Order RecordGoogle SheetsService
  24. 24Telegram - Send Order ConfirmedTelegramService
  25. 25Mark Reminder SentGoogle SheetsService
  26. 26Split Out MedicinesSplit OutLogic
  27. 27Telegram - Send Order SummaryTelegramService
  28. 28Lookup Medicine In InventoryGoogle SheetsService
  29. 29Check Stock AvailableIfLogic
  30. 30Update Inventory StockGoogle SheetsService
  31. 31Aggregate Order LinesAggregateLogic
  32. 32Build Order SummaryCodeLogic

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.