Fields, not free text
The model fills a defined structure. The router never has to search a paragraph for a department name, and a caller receives the same shape every time.
AI and automation / 2026
A shared inbox gets sorted by whoever reads it first. Subject lines rarely say which team should act, so sorting needs the meaning of the message in a form software can use.
The assignment was to classify incoming emails into business departments. The scenario takes the email by webhook and makes one OpenAI call that must return three structured fields. The category is limited to Sales, Customer Service, HR, Finance, Operations or Other, spelled exactly, so a router can compare it directly. Each department has a branch and Other is the fallback. Each branch returns the department, summary and priority as JSON.

Walkthrough
Built from the assignment recording: the scenario, the prompt and its structured fields, the six branches, a test email routed to Sales, and the run log.
My part
Engineering
The model fills a defined structure. The router never has to search a paragraph for a department name, and a caller receives the same shape every time.
The prompt names the six allowed values and asks for exact spelling. The field definition repeats them as examples. That keeps the model's answer inside what the router can match.
The model's output is only an input to the filters. Which branch runs is decided by an exact comparison in the scenario, where it can be read and changed without touching the prompt.
An email that belongs to none of the five departments is classified as Other and takes its own branch, so it is not pushed into the nearest wrong team.
Screens
HOW IT WORKS
A webhook accepts a JSON body with the email's subject, sender and body.
The OpenAI module receives those three values and a prompt that allows exactly one of six categories.
The model's reply is constrained to three fields: category, summary and priority.
A router compares the category with each department name. Other is the fallback route.
The matching branch returns the department, summary, priority and a routing message as JSON.
Built with
Work with me
I build workflows like this one as a fixed-price service: one defined, tested n8n or Make.com workflow, with packages from $149.
More work
Gazelle's KitchenA WhatsApp assistant for a home kitchen. It takes orders and only passes the owner finished orders and chats that need her.PilotGuarded Order AgentA Mastra agent that takes food orders over chat. Code decides who gets a reply, whose orders a tool can read and what counts as a valid order. 16 eval cases check the order store after each conversation.DemonstrationSellavie AIMy own product for answering a small business's customer messages on Instagram, Facebook and WhatsApp and taking orders from them.Maintained