In this lesson
The AI reads, the rule decides.
Today you put an AI box in the middle of the flow. It reads the messy text and returns a word the rule understands.
- Use AI to classify, extract or summarize
- Ask for an answer in a fixed format
- Test with ten messages before you trust it
The problem: messages with no category
The school gets messages like "I'd like to know the price" and "my boleto won't open" (a boleto is a Brazilian bank payment slip). The spreadsheet stores them all the same way. Nobody knows what is urgent.
An ordinary condition does not solve this, because the text is free-form. This is where the AI step comes in.
Three uses
- Classify: pick a category. "Is this a question, a quote request or a complaint?"
- Extract: pull fields out of the text. "Product, quantity, deadline."
- Summarize: shorten a long text to two lines.
Start with the one that is easiest to check: classifying.
Ask for a fixed format
AI likes to chat. A flow does not. So say exactly what you want. An example request:
Notice three details. The list is closed. The words have no accents or punctuation. And there is an "Other" for whatever does not fit.
To extract several fields, ask for an answer in JSON. It sounds hard, but it is just a list with names: {"product": "t-shirt", "quantity": 10}. Many tools have a "structured output" mode that guarantees this shape.
The rule decides the path
After the AI, a condition looks at the word and chooses: Quote goes to the salesperson, Complaint to the manager. And everything that did not match falls into a fallback path, which notifies a person. Without it, messages disappear.
What the pros know
Text sent to an AI model leaves your company. In the Gemini terms, Google says that in free use (Google AI Studio or the free quota) the content you send may be used to improve its products, and people may review it. In the paid service, with billing active on the project, Google says it does not use the requests for that. People who work with AI read this policy before turning the flow on, and send the AI only the fields it needs, never the customer's whole record.
How much it costs
Providers charge by the amount of text that goes in and comes out. A short message costs very little. But the cost grows with volume: if the flow runs a thousand times a month, it is worth looking at the provider's price table once and doing the math. Sending only the text that is needed, and not the whole conversation, also lowers the bill.
Ten test messages
Before you trust it, test it. Write ten made-up messages, two of each type, and include a strange one. Run them and count the correct answers. If the AI got some wrong, improve the request, save it as "v2" and run the ten again.
A hit rate of 9 out of 10 is good to start with, as long as the error lands on a person who checks.
The AI step sheet
Keep on one page: the text of the request with its version (v1, v2), the provider, the date you read the policy and the hit rate on the ten messages. Three months from now, when someone asks why the AI classifies this way, the answer will be there.
And a warning: if the request changed, run the ten messages again. Improving one case can make another worse.
Practice · 10 min
- Paste the request from this lesson into the AI step, after the step that saves to the spreadsheet. Test it with a message asking for a quote.
- Run the ten made-up messages. Write down the category that came back and whether it was right.
- Open your provider's data policy and write down the date you read it.
Summary
- The AI reads the free-form text; the rule decides the path.
- Three uses: classify, extract and summarize.
- Ask for a fixed format, with a closed list and an "Other" way out.
- Every flow needs a fallback path.
- Read the provider's data policy: the free plan may use what you send.
- Test with ten messages before you turn it on.
Sources
Read on October 30, 2026.
- n8n. Text Classifier: classifying with a list of categories
- OpenAI. Structured model outputs: answer in a fixed format
- Google. Gemini API Additional Terms of Service: data use in the free and the paid service
Lesson quiz
Three situations to apply what you learned.
Isaque Victor free courses