A customer reports a duplicate charge. The email body names an order, the attached invoice shows its own number, and the quoted thread refers to an earlier purchase. A support assistant can read all three references correctly and still attach the wrong order to the ticket. The job starts with extraction and ends when the team can show which record the customer’s current request concerns.
For a support lead, start with an internal order suggestion and a review queue. Have the assistant collect candidates from the email and its attachments. Check their format and look them up within the right account or store. Leave the order field empty when the lookup fails, the evidence points to different orders, or a character in the reference is unreadable.
Keep each reference next to the evidence that produced it
Read the new message and its subject alongside any quoted thread text. Mark quoted or forwarded passages so an agent can distinguish history from the current request. An earlier reference can still matter when the customer replies in the same thread. Verify that connection before using it. An explicit reference in the latest message deserves attention, but the thread may contain a correction or an attachment that contradicts it.
Use embedded PDF text where the relevant text is available and usable. Run optical character recognition (OCR) on screenshots and scanned pages without usable text. Keep the attachment, page and region with each extracted candidate, or retain a link to the relevant message passage. Capture the nearby label and any text that identifies what the customer means. A string under “Invoice number” should enter a different lookup from a string under “Order number,” even if they share a format. Keep both sources when a screenshot repeats a reference already present in the message.
Tesseract’s third-party documentation shows TSV output with page and word positions, bounding boxes, recognised text and a confidence column. Read the confidence for the words that make up the reference and capture their boxes so the reviewer can inspect the crop. A page full of clear text can still contain a blurred digit in the one field that matters. Use confidence as a review signal and tune the rule on your own images. If the reference is split across OCR words, check the weakest relevant token and the layout before accepting the join. Tesseract, Command Line Usage
The screenshot triage guide covers how to recover context when the image is the whole ticket. This workflow starts with a narrower decision. Can the evidence identify an order for the current request? Triage Support Tickets That Arrive as Screenshots Only
Validate the whole reference and look it up in the right system
Define the accepted formats for each store or billing system. Preserve the string as seen and apply only normalisations that the source system treats as equivalent. Keep leading zeros, prefixes and separators unless the system’s rules say they can be removed. If an image could read as either the letter O or the digit zero, hold the candidate for review. A valid-looking order found after changing the character still needs evidence from the customer’s message or document.
Python’s third-party documentation says that re.fullmatch() checks the entire string against the pattern. Capture the complete reference, including its prefix and suffix, before running the format check. If extraction has already clipped a tracking code down to an order-shaped substring, re.fullmatch() can accept that substring. A pattern match lets the reference proceed to lookup. Record existence and its relationship to the ticket require separate checks. Python, Regular expression operations
Route an order number to the order system and an invoice number to the billing system, using the account or store scope established by your support process. Follow the invoice record’s stored relation to the order. If that relation leads to several orders, show them to the agent. If the order and invoice both point to the same record under the same account, keep both pieces of evidence on a single suggestion.
Shopify’s third-party Admin GraphQL documentation lists a name filter on its orders query. When using that filter, compare the returned order name to the expected value in the relevant shop, then store the order’s internal ID with the proposed link. Confirm the customer or account relationship under your support policy before attaching the record. A typed or photographed order number can help find a record. Use the existing requester verification policy to decide what information the agent can disclose. Shopify, Admin GraphQL orders query
Hold ambiguous matches with a reason the agent can act on
Write the proposed record, source evidence and lookup result to an internal review view. Show the few fields needed to resolve the match and link back to the original artifact under the ticket’s access controls. Give the reviewer a reason that tells them what to check next.
| What the workflow sees | What the reviewer gets |
|---|---|
| Several plausible references point to different orders | The candidates, the corresponding message passages or attachment crops, and the scoped matches. The agent checks which order the current request refers to. |
| A valid reference has no match in the order system | The raw reference and the scope searched. The agent checks the store or billing source and asks for the exact reference if needed. |
| A reference has low OCR confidence or is clipped | The image crop and the recognised text with the uncertain part marked. The agent reads the source or requests a clearer copy. |
| The order lookup times out or access fails | The failed lookup and its scope. Keep the ticket pending verification and retry eligible errors before asking the customer to resend anything. |
| The record exists but the account check is unresolved | The verification status and the next step under the existing support policy. Keep order details out of any customer reply until the check passes. |
A reviewer can confirm a record, choose a different one with supporting evidence, or leave the ticket unlinked. Save the decision with the candidate, the message or attachment revision and the time of the lookup. If a new customer message arrives before the agent confirms, surface the change and recheck the suggestion. Show confirmed references and the unresolved reason in the ticket handoff so the next agent can pick up the work. What an AI Assistant Should Pass to a Zendesk Agent
Test the order link on tickets the team already resolved
Start with one inbox and one order system. Replay redacted examples using the messages and attachments available when an agent first needed to identify the order. Keep the confirmed order and the grounds for confirmation as the reference answer. Include tickets that legitimately had no link at that point. Use later agent notes to label the outcome where appropriate and keep them out of the assistant’s input. Build an Evaluation Set for Support Replies Before Launch
Include a legible invoice from the wrong account, adjacent references that differ by a character, an older order in quoted text and an invoice that covers several orders. Include screenshots where the label is clear and part of the reference is obscured. Check how the workflow behaves when its lookup has incomplete access or the order system is down. A test based only on clean attachments will miss the cases that cost agents a second pass.
Run the workflow in shadow mode before it writes to the ticket’s order field. Track wrong links among suggested links, correct holds among cases that needed review, and resolvable tickets held back. Break those results out by email text, PDFs and screenshots so a clean source cannot hide a weak one. Watch how long agents take to resolve held cases and whether they can reach the evidence directly. Use the results to decide which inputs, if any, can populate the internal order field automatically. Keep the verified link and any subsequent customer reply or order action as separate decisions.
Sources
- Tesseract documents TSV output with recognised text, position and confidence fields. Tesseract, Command Line Usage
- Python documents how
re.fullmatch()checks an entire string. Python, Regular expression operations - Shopify documents filtering its Admin GraphQL
ordersquery by order name. Shopify, Admin GraphQLordersquery
Request an audit of your support order lookup
Bring a redacted support email, its attachment and the order record an agent used to resolve it. We can trace where the reference comes from, what verifies the link and what an agent needs to see when the workflow cannot decide. Request a free AI workflow audit
