n8n: An AI Call and Ticket Router That Returns Strict JSON (Category, Urgency, Summary) and a Switch Node That Acts on It
Описание и применение
Рецепт позволяет небольшим офисам автоматически маршрутизировать звонки и заявки, используя ИИ для классификации по категории, срочности и краткому резюме, а затем отправлять их в нужную команду через n8n.
Задача
Incoming calls or tickets often land with the wrong person, causing repeated customer explanations and delayed responses.
Результат
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.
Рабочий процесс
- 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.
Доказательства
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.
- Дата записи: 2026-10-23T16:11:38.216Z