Module 2 · AI in the middle of the flow

Adding an AI step to the flow

Lesson 4 of 12 8 min lesson Updated on October 30, 2026
Progress in the course33%

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.

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

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:

Classify the message into one of these categories: Quote, Question, Complaint, Other. Answer with the category only, with no other words.

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

  1. 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.
  2. Run the ten made-up messages. Write down the category that came back and whether it was right.
  3. Open your provider's data policy and write down the date you read it.

Summary

Sources

Read on October 30, 2026.

  1. n8n. Text Classifier: classifying with a list of categories
  2. OpenAI. Structured model outputs: answer in a fixed format
  3. 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.

Lesson 4 of 12

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp