"Where is my order?" is the question that separates a support chatbot that reads documents from one that reads your business. A help article can tell a customer your shipping policy. It cannot tell them that their order shipped on Tuesday and arrives on Thursday, because that answer does not exist in any document. It exists in one row of your order table, and it changes every few hours.
That is what this post is about: the order-status lookup, done through NL-to-SQL. The general introduction to NL-to-SQL is already on this blog (https://www.chatonn.com/blog/nl-to-sql-chatbot-database-queries), and so is the full order-tracking playbook (https://www.chatonn.com/blog/ai-chatbot-for-order-tracking-and-shipping-2026), including the pipeline and the return-on-investment math. This post is the part in between: what the bot actually needs to know, which questions it must answer, where it goes wrong, and how to test it before customers meet it.
The five questions an order lookup must answer
Before connecting anything, write down the questions. For most stores, an order-status lookup has to handle five:
1. Where is my order? Status, current location or milestone, and expected delivery date.
2. What is in my order? Items, quantities, and any item that shipped separately.
3. When will it arrive? The delivery estimate from the latest tracking milestone, not the estimate from checkout day.
4. Has my refund gone through? Refund status, amount, and date, for returned or cancelled orders.
5. Can I change the delivery address? This one is a trap. The bot can check whether the order has shipped yet, but changing an address is a decision with consequences, and it belongs with a human.
If your lookup cannot answer the first three cleanly, do not ship it. The last two are where most order bots lose trust, so they get their own sections below.
What the bot needs to know: the shape of an order
NL-to-SQL works by translating a plain-English question into a query against your database. The translation is only as good as the schema it can see. Before launch, make sure the bot can reach, at minimum:
- Order identifier: order number, plus the customer email attached to the order.
- Status: the order's current state in your system, in your own words, not a carrier code.
- Items: what was ordered, in what quantity, and whether each item shipped.
- Tracking: carrier name, tracking number, and the latest milestone with its timestamp.
- Dates: ordered, shipped, and estimated delivery.
Chatonn's Database Connect exposes the schema to the assistant through a schema explorer, and table-level access control decides exactly which tables and columns a query may touch. That last point is not a detail. An order table often sits next to payment and customer tables in the same database. The bot should be able to read order status and tracking, and nothing else. If a column is not needed to answer the five questions above, it should not be reachable.
Read-only enforcement is the other half of the same rule. The bot asks questions of your database; it never changes it. A customer asking about an address change gets a human, not a bot with write access.
The identifier problem
The hardest part of an order lookup is not the SQL. It is working out which order the customer means.
A customer rarely opens with an order number. They open with "where is my order?" and expect the bot to know. There are three identifiers a bot can reasonably use, in this order:
1. A logged-in session. If the shopper is authenticated on your site, the widget already knows who they are. This is the best case and the one to design for.
2. Order number plus email. One order number on its own is weak verification. Order number plus the email on the order is a reasonable check for a guest checkout.
3. Email alone. This works only if the customer has one open order. If they have three, the bot has to ask which one, and that is fine. Asking one clarifying question is good service. Asking three is an interrogation.
What the bot must never do is guess. If two orders match, say so and list them by date and item, then let the customer pick. If no order matches, say so plainly. "I can't find an order with that number" is a better answer than a confident answer about somebody else's parcel.
Identity verification comes first, before any order detail is shown. Order details go only to the person who owns them, verified by email or login. That rule is not negotiable, and it is the same guardrail the order-tracking playbook sets out.
The answer format: one line of status, one line of detail
A good order-status answer is short. The customer wants three facts: where it is, when it arrives, and how to follow it. A reply shaped like this covers it:
"Your order #10432 shipped on Tuesday and is out for delivery, expected Thursday. Here is your tracking link."
What does not work is dumping the raw query result: a table of database columns, internal status codes, or a tracking history ten lines long. The bot's job is to translate twice, once from English into SQL, and once from the query result back into a sentence a customer can read in five seconds. If the tracking shows a delay, that belongs in the same short reply, honestly, with the next step attached: "It is running two days late. I have raised a ticket with our team and they will check with the carrier."
The edge cases that decide whether customers trust it
A bot that handles the happy path and fails everything else is worse than no bot, because the customer believed the first answer. Test these five cases before launch:
- Order not found. No match, or the number is mistyped. The bot says so, asks for the email on the order, and after one retry offers a human. It never invents a status.
- Cancelled or refunded. The order exists but is no longer shippable. The bot states the cancellation or refund status, amount, and date, then stops. It does not offer to re-ship.
- Partial shipment. One item shipped, one is still packing. The bot lists each item with its own status. A single status for a split order is a wrong answer.
- Stuck or delayed. No tracking update for days, or a carrier exception. The bot acknowledges the delay, apologises once, and creates a ticket with the full order context attached, so the agent does not ask the customer to start over.
- Address change or order edit. The bot checks whether the order has shipped. If it has not, it hands off to a human with the requested change attached. If it has, it says so and explains what is still possible.
Every one of these ends the same way when the bot cannot answer with confidence: a handoff to a human with a brief, not a transcript dump. The brief is the intent in one line, what was already verified, what was already tried, and the order number. That is the difference between a handoff and a restart.
Testing before launch: twenty real questions
Do not launch an order lookup on synthetic questions. Take twenty real order-status questions from your own ticket queue, including the awkward ones: a mistyped order number, a customer with two open orders, a question asked without an order number at all, a refund question phrased as a delivery question. Run them through the bot and check three things for each: did it identify the right order, did it answer from the live record rather than a policy, and did it hand off instead of guessing when it could not?
Keep the ones it gets wrong. That list is your golden set. Re-run it every time you change the schema, the access rules, or the wording of the handoff. A lookup that drifts is a lookup that starts inventing delivery dates, and the customer finds out before you do.
Rollout: status first, then the rest
Start with order status only. That is the highest-volume question and the easiest to verify, because every answer can be checked against the order system in seconds. Once a week of live answers shows no invented dates and clean handoffs, add refund status, then item-level detail for split shipments. Account-data questions, balances, subscription status, loyalty points, are the same pattern on different tables, and they are the subject of the next post in this series.
The setup itself is small. In Chatonn, Database Connect is a paid feature, included in the Pro plan with no per-query billing: connect PostgreSQL, MySQL or SQLite, check the schema in the explorer, set table-level access to the order tables only, and test a query before the widget goes live. The docs (https://www.chatonn.com/docs) walk through the connection step by step. What takes the time is the part above: the identifiers, the edge cases, and the twenty test questions. That work is what makes the difference between a bot that answers "where is my order?" and one that customers trust with the answer.
FAQ
Does NL-to-SQL replace the knowledge base?
No. The knowledge base answers policy questions from your documents, such as the return window or the shipping zones. NL-to-SQL answers data questions from your database, such as where a specific order is. A support bot needs both, and the general NL-to-SQL post explains how they fit together.
Which databases can it connect to?
PostgreSQL, MySQL, or SQLite, through Database Connect. The bot reads through a schema explorer with table-level access control, and queries are read-only.
Can the bot change an order, cancel it, or edit an address?
No. Queries are read-only by design. Changes go to a human through a ticket or live-chat handoff, with the order context attached.
What happens if a customer asks about someone else's order?
The bot verifies identity first, by login or by order number plus the email on the order, and shows order details only to the person who owns them. If the check fails, it says so and offers a human.
How much does it cost?
Database Connect is a paid feature, included in the Pro plan with no per-query billing. Chatonn pricing is flat: Free BYOK, Pro $49/mo, Business $149/mo, with no per-seat or per-resolution fees. The cost calculator (https://www.chatonn.com/tools/ai-support-cost-calculator) shows the comparison against per-seat and per-resolution tools.
Sources: Chatonn docs, Database Connect section, checked live 2026-11-24; the general NL-to-SQL post and the order-tracking playbook linked above. Prices last verified 2026-11-24.
Put this into practice
Chatonn turns your documentation into an AI support agent that answers instantly and hands off to your team when it should.