Skip to content
Visual explainer 3h to learn 5 steps

Classify and summarise booking requests with n8n AI nodes

Route synthetic requests by a structured category and summary, and compare rules, a model node and a deterministic stub.

By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 10 minutes to read.

Topic 10 of 43

In short

The Text Classifier node sorts a message into categories you define, and the Information Extractor node pulls out fields such as a short summary. Both need a chat model connected to them. Start with plain rules, add the model only where rules fall short, and keep a stub so tests do not call a paid model.

Think of it like this: Rules are a sorting tray with clear labels. A model is a helper who reads messy notes and still puts them in the right tray, but you check their work against a few known examples.

Explained simply

Classifying means putting something in a box. For booking requests the boxes might be new booking, change, cancel, question and other. Summarising means shrinking a long message to one or two plain sentences. Both are jobs a language model does well, and n8n has nodes for them.

The Text Classifier node takes a piece of text and sends the item out of the output that matches its category. You write each category name and a short description. The Information Extractor node returns named fields, such as a summary and an urgency, in a fixed shape. Each of these nodes needs a chat model node connected below it.

Do not reach for a model first. If a request has a field called type, or the subject says cancel, a plain rule in a Switch node is free, instant and always gives the same answer. Add the model only for the messy rest.

To test without cost, put a stub in place of the model: a node that returns a fixed category. Your routing can then be proved without a live model. Finally, make a small labelled set of synthetic requests and count how many each method gets right.

Press Play on a diagram to walk through it one step at a time.

FlowRoute a booking request
  1. 1
    Webhook

    Synthetic request arrives

  2. 2
    Rules first

    Keyword or field checks in a Switch

  3. 3
    Text Classifier

    Only for what rules cannot place

  4. 4
    Information Extractor

    Short summary

  5. 5
    Switch

    Send to the right branch

CompareThree ways to classify
Rules
  • Free and instant
  • Same answer every time
  • Breaks on new wording
Model node
  • Handles varied wording
  • Costs money and time
  • Answers can vary
Stub
  • Returns a fixed category
  • Used in tests and demos
  • Proves the routing works
MapExample categories for booking requests
Booking request
  • new_booking
    • Wants a first appointment
  • change
    • Move or edit an existing booking
  • cancel
    • Cancel a booking
  • question
    • Needs an answer, no booking
  • other
    • Goes to a person

In depth

Write routing rules first

List what you already know. A structured form has a request type. A subject line may start with Cancel. A message from a known address may always be a change. Turn these into a Switch node with clear conditions and an explicit fallback output.

This gives you a baseline. If rules already place most requests correctly, a model only needs to handle the leftover cases, which cuts cost and variation. Write down the rule coverage as a number, for example 14 of 20 synthetic requests, so you can tell later whether the model really adds value.

  • Switch node for clear conditions
  • Always add a fallback output
  • Measure rule coverage on a labelled set
  • Model handles only what rules leave

The Text Classifier node

Add the node, set the text to classify (an expression such as the message field) and add categories, each with a name and a description. The descriptions matter because the model reads them. Say what belongs and what does not.

The node connects to a chat model sub-node. In its options you can allow multiple categories, and choose what happens when nothing clearly matches: discard the item, or send it to an extra Other output. Use the Other output and connect it to review, so unclear requests are not lost.

  • Write specific category descriptions
  • Keep categories few and distinct
  • Send no-match items to a review branch
  • Use a low temperature in the chat model for steadier answers
LayersParts of a classifier setup in n8n
  1. 1
    Input text

    The request message as an expression

  2. 2
    Text Classifier node

    Categories and their descriptions

  3. 3
    Chat model sub-node

    Model name, temperature, credential

  4. 4
    Category outputs

    One output per category plus Other

Extract a short summary

The Information Extractor returns fields you define. Give each a name, a type and a plain description, such as summary: one sentence, no names or phone numbers. You can describe the attributes in the node or give it a JSON example or schema.

Short summaries help the person who reviews the request. They should be limited in length and avoid copying personal data that is not needed. Ask for fields that help routing too, such as urgency or preferred date, but check them afterwards, as the next topic explains.

  • Name each field and describe it
  • Limit summary length in the description
  • Avoid copying personal data into summaries
  • Treat all output as untrusted until checked

A deterministic stub and a comparison

A stub is a node that returns a fixed answer in the same shape as the model node, for example a Code node that picks the category from a keyword or from a test field. Put it behind the same Switch. Then your tests, demos and CI-style checks need no model, cost nothing and never vary.

To compare, make 20 synthetic requests with the correct category written next to each. Run them through rules, the model node and the stub. Record correct counts and runtime. If the model beats rules by a small amount on cost-heavy volume, rules plus review may be the better design.

  • Same output shape as the model node
  • Use it in tests and demos
  • Run one labelled set through all three
  • Record accuracy, time and cost together

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Write routing rules first~35m
  2. 2
    Use the Text Classifier node~35m
  3. 3
    Extract a short summary~35m
  4. 4
    Swap in a deterministic stub for tests~35m
  5. 5
    Compare accuracy on a small set~35m

Key points

  • Write the routing rules before you add a model. Many requests need no model at all.
  • The Text Classifier has one output per category. Set what happens when no category clearly matches.
  • Ask the Information Extractor for named fields, such as summary and urgency, with a short description of each.
  • Swap the model for a deterministic stub so tests run free and give the same answer every time.
  • Measure accuracy on a small labelled set, for example 20 synthetic requests, and compare rules, model and stub.

Key terms

Tap a card to flip it. 0/5 known

Examples

A deterministic stub

This Code node returns the same output shape as the classifier, based on keywords. Use it in tests so the Switch below it can be proved without a model.

javascript
return $input.all().map(item => {
  const t = (item.json.message || "").toLowerCase();
  let category = "other";
  if (t.includes("cancel")) category = "cancel";
  else if (t.includes("move") || t.includes("change")) category = "change";
  else if (t.includes("book") || t.includes("appointment")) category = "new_booking";
  else if (t.includes("?")) category = "question";
  return { json: { ...item.json, category, source: "stub" } };
});

A small labelled comparison

Make 20 synthetic requests with an expected category. Run each method and fill a table like this. Numbers here are made up to show the layout.

text
method        correct  review  avg time
rules only    14/20    6       5 ms
stub          13/20    7       5 ms
model node    18/20    2       1.2 s
rules+model   19/20    1       0.5 s
Conclusion: rules first, model for the leftover.

Quick reference

  • Rules first in a Switch; add a model only for what rules cannot place.
  • Text Classifier: one output per category; set what happens on no clear match.
  • Information Extractor returns named fields you describe or give as a schema.
  • Both AI nodes need a chat model sub-node and a credential for it.
  • Use only synthetic requests while practising.
  • A stub returns the same output shape with no model call.
  • Compare methods on one labelled set: accuracy, time, cost.

Common mistakes

  • Letting the model decide things a simple rule already answers, which adds cost and variation.
  • Testing on three easy examples and calling it accurate. Include messy and unclear ones.
  • Sending real customer text to a model during practice. Use synthetic requests only.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Why write routing rules before adding a model?

Question 2

2What does the Text Classifier node need connected to it?

Question 3

3What is a deterministic stub for?

Question 4

4Where should requests with no clear category go?

Question 5

5How do you fairly compare rules, a model and a stub?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Create five synthetic booking messages and write the correct category next to each in a table.

  2. Exercise 2medium

    Build a Switch with rules and a fallback, then add the stub in front of it. Show all five messages reach the right branch.

  3. Exercise 3hard

    Replace the stub with a Text Classifier and a chat model in a lab. Add an Other output to review, run 20 labelled messages, and report accuracy against rules and the stub.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Do I need a paid model to learn this?
You need some chat model for the AI nodes. Use a free trial, a free tier or a local model server in a lab, and use a stub for everything that does not need a real model.
Which is better, Text Classifier or a plain prompt?
The Text Classifier gives one output per category, which is handy for routing. A plain prompt with a parser gives more control over the output shape.
Can I send real customer messages to the model?
Not while learning. Use synthetic text, and check your provider's data terms before using real data.
How many categories should I use?
Keep them few and clearly different. Five or fewer is a good start.

Go deeper

ShareXLinkedInWhatsApp