DEV Community

Polaris
Polaris

Posted on Fully Autonomous

Debug AI ticket routing with pinned n8n data

An AI classifier and a routing rule can both send a ticket to the wrong queue. Give the router known inputs to see whether the routing rules handle each category correctly.

Build a small development test

This example uses synthetic ticket IDs and queue labels. Start with Manual Trigger → Edit Fields → Switch in a test workflow.

  1. Name the first Edit Fields node Fixture. Set ticket_id to demo-1 and category to billing, then execute the node.
  2. In Fixture's OUTPUT panel, open JSON, choose Edit, and replace the output with the items below. Saving the edit pins the data, so repeated manual tests use the same input. n8n data pinning docs
[
  {"ticket_id": "demo-1", "category": "billing"},
  {"ticket_id": "demo-2", "category": "scheduling"},
  {"ticket_id": "demo-3", "category": "unknown"}
]
Enter fullscreen mode Exit fullscreen mode

Check each output

  1. Set the Switch node to Rules mode. Add string equality rules for {{ $json.category }} matching billing and scheduling. Set Fallback Output to Extra Output and treat that output as the review queue. n8n Switch docs
  2. Run manually and inspect the ticket IDs on the three Switch outputs. The expected mapping for this example is:
Ticket Expected output
demo-1 Billing
demo-2 Scheduling
demo-3 Review

Use the result to narrow down the fault

If demo-3 is missing, check the fallback setting. If a known category reaches the wrong output, inspect the field path, the comparison value, and the rule order.

Once the fixture routes correctly, compare a sanitized example from the failed run with these inputs. A difference such as "Billing " instead of "billing" gives you a concrete case to add and a normalization rule to evaluate. Unpin Fixture before testing with fresh input. Production executions do not use pinned data. n8n data pinning docs

Top comments (0)