A supplier who usually delivers on time sends a message an hour before opening: out of stock today. Or the van arrives with six boxes instead of ten. The owner starts calling around, often to the first number that answers, and pays whatever is asked. A backup supplier plan decided in advance, with the numbers ready, turns that scramble into one tap.
The automation watches every open purchase order and marks it failed when any one of these happens:
Watching both status and time matters. Many suppliers never send a message; they simply do not turn up.
Not every failure is an emergency. The automation measures urgency in hours, not in feelings:
hours to stock-out = stock now ÷ (average daily use ÷ opening hours)
| Urgency | Rule | What matters most |
|---|---|---|
| Critical | 8 hours or less of stock, or less than the main supplier’s next delivery time | Speed, then reliability |
| Soon | Up to 3 days of stock | A balance of reliability, price and speed |
| Calm | More than 3 days of stock | Landed price, then reliability |
Example, with illustrative numbers: 6 kg left, 18 kg used per day, 12 opening hours. Hourly use is 1.5 kg, so stock runs out in 4 hours. That is Critical, and the fastest reliable backup goes to the top, even if it costs more.
The same list of suppliers is sorted differently depending on urgency. When stock runs out in hours, a cheaper supplier who delivers tomorrow is useless. When there are days of stock, paying extra for speed is wasted money.
For the Soon case, the automation uses a blended score:
Example: Supplier A is on time 90% of the time, costs ₹1,050 landed and delivers in 6 hours. Supplier B is on time 70% of the time, costs ₹950 and delivers in 24 hours. A scores 0.60 and B scores about 0.38, so A is offered first despite the higher price. The top two are offered.
A supplier with fewer than three past orders is labelled “new, little history” and given a neutral 70% on-time rate, so one bad or lucky delivery does not decide their rank.
Start Supplier Options with the top 30 items by spend. For each one, ask the owner a single question: if this supplier fails, who do you call? Items with only one answer go on a weekly single-supplier risk list.
The alert shows the failed order, stock now, daily use, the projected time stock runs out, and the ranked backups with price, lead time, on-time rate and order count. Three buttons follow: order from backup 1, order from backup 2, or wait for the main supplier.
Tapping a backup creates a new purchase order for the remaining quantity, marks the old one Cancelled-Switched, logs the switch, and sends or prepares the message for the supplier. Tapping wait sets a time to check again. Nothing is ordered without the owner’s tap.
Two entry points feed one chain. A Google Sheets trigger catches status changes to Out of Stock or Short Supply. A schedule runs every 30 minutes during business hours to catch overdue and short orders. A Remove Duplicates step, keyed on the PO number, makes sure one failure produces one alert even if both paths catch it. Code steps calculate hours to stock-out and rank the options by urgency, and Telegram sends the message with buttons.
A second workflow handles the button taps, and a third runs every night at 11 pm to recalculate each supplier’s on-time and short-supply rates from the last 90 days. The n8n documentation covers these triggers and the Telegram node. Shops with fewer than 50 open orders can do the same with Google Sheets and about 180 lines of Apps Script.
| Test | What to do | What should happen |
|---|---|---|
| Status change | Mark a test order Out of Stock | Alert within about a minute |
| Overdue | Promised 3 hours ago, still Ordered | Alert at the next sweep |
| No duplicate | Trigger both paths for one order | Exactly one alert |
| Critical | Stock near zero | Fastest backup first |
| Calm | A week of stock | Cheapest landed price first |
| No backup | Item with one supplier | “No backup listed”, added to risk list |
| Short supply | Receive 6 of 10 | Alert for 4 units only |
The Supplier Score tab is the quiet benefit. After a few months it shows, in numbers, which supplier is reliable and which one only looks cheap. That record is exactly what to bring to a price conversation, and a purchase brief built from price history puts it on one page. Before adding any new backup supplier, especially one found online, run a GST number check before paying an advance. And if you run two branches, the quickest backup may be your own: an inventory transfer between branches often covers a gap faster than any supplier.
When my team sets this up, the person who receives deliveries is trained to mark Received, Short Supply and Out of Stock as it happens, because the whole system depends on that one habit. After two weeks, we read the Switch Log together and adjust the grace periods.