n8n: An AI Call and Ticket Router That Returns Strict JSON (Category, Urgency, Summary) and a Switch Node That Acts on It
Description and use
The recipe enables small offices to automatically route calls and tickets using AI to classify by category, urgency, and summary, then forward them to the correct team via n8n.
Problem
Incoming calls or tickets often land with the wrong person, causing repeated customer explanations and delayed responses.
Outcome
The recipe enables a small office to automatically route calls or tickets to the correct team based on AI-generated categories, urgency, and summary, reducing manual forwarding and improving response times.
Workflow
- 1. Define a JSON schema with required properties and strict validation.
- 2. Test the schema and prompt with a curl call to OpenAI’s chat completions API.
- 3. In n8n, add an HTTP Request node after the trigger to call the OpenAI API with the JSON body.
- 4. Parse the JSON response and use a Switch node on the "category" field to route to the appropriate team or person.
- 5. Handle the "other" fallback when the model is uncertain.
- 6. Optionally, forward the summary and caller details to the chosen recipient.
Evidence
The answer comes back as a JSON string in choices[0].message.content.
The enum on category is what makes the Switch node reliable later.
- Record date: 2026-10-23T16:11:38.216Z