How to build a Telegram delivery tracking bot
By the Botable team
A Telegram delivery tracking bot watches a parcel and messages the customer when its status actually changes, rather than every time it checks. Describe your carriers and which events are worth a notification, and Botable builds the polling schedule, the status normalising and the alerts.
What is a delivery tracking bot?
A Telegram delivery tracking bot exists to remove the most common message any shop receives, which is "where is my order". It stores a tracking number against a chat, polls the carrier on a schedule, and pushes a message when the status changes — not when it is checked. That distinction is the whole design: a bot that reports the current status on every poll is a spam machine, and one that reports only transitions sends perhaps four messages across a delivery. Carrier APIs are the awkward part, since each has its own status vocabulary, and normalising them to a small shared set — accepted, in transit, out for delivery, delivered, exception — is what lets one bot handle several. Exceptions deserve their own treatment: a failed delivery or a customs hold is the one status where a person needs to act, and it should read differently from routine progress.
What commands does it have?
| Command | What it does |
|---|---|
/track <number> | Starts watching a parcel |
/status | Current status of everything tracked |
/parcels | Active and delivered parcels |
/stop <number> | Stops watching one |
/carrier <name> | Forces a carrier if detection is wrong |
What do you need before you start?
- A Telegram bot token from @BotFather
- The carriers you ship with and access to their tracking APIs
- Which status changes deserve a message and which do not
How do you build it?
How often should it poll a carrier?
Every few hours for a parcel in transit, more often once it is out for delivery, and not at all after it is delivered. Ask for the interval to vary by status — a fixed frequent poll across every parcel is what gets your API key rate-limited.
Which events actually deserve a message?
Accepted, out for delivery, delivered, and any exception. The dozen intermediate scans between depots are noise to a customer. Say which transitions notify, or the bot will narrate a journey nobody asked to follow.
How do you support several carriers at once?
Normalise their statuses into one small vocabulary and detect the carrier from the tracking number format where you can, with a manual override for when detection is wrong. Without normalisation, every carrier needs its own notification logic and its own bugs.
How should exceptions be handled differently?
Loudly, and with a next step. A customs hold or a failed delivery is the one status where the customer must do something, so it should say what and link to it. Treating it like another progress update is why parcels get returned to sender.
A prompt you can use as-is
Paste this into Botable and adjust the details. It is specific on purpose — a vague description produces a vague bot.
Build a delivery tracking bot. /track <number> detects the carrier from the number format, starts watching, and confirms. Poll every 4 hours while in transit, every 30 minutes once out for delivery, and stop after delivered. Normalise carrier statuses to accepted, in transit, out for delivery, delivered and exception, and message the customer only on a transition — never on an unchanged poll. Exceptions get a distinct message naming what has happened and what to do. /status lists everything tracked with its latest state, /parcels shows active and recently delivered, /carrier <name> overrides detection.
Who is this bot for?
- Shops that answer the same "where is my order" question daily
- Anyone shipping across several carriers who wants one interface
- Customers who would rather be told than have to check
What goes wrong with this kind of bot?
- Reporting status on every poll instead of on change turns the bot into spam
- Carrier vocabularies differ wildly; normalise before you build the notifications
- Polling delivered parcels forever quietly burns your API quota
Questions about delivery tracking bots
Can it link a parcel to an order automatically?
Yes, if your store can post the tracking number and the customer's chat id when it ships. That removes the step where the customer has to paste a number, which is where most of them drop out.
What if a carrier has no API?
Some only offer a tracking page, which can be fetched but breaks whenever they redesign. Prefer carriers with an API for anything you depend on, and expect page-scraped tracking to need maintenance.