n8n text classifier node

Table of Contents

A text classifier is an automated system that categorizes text into predefined labels or classes based on its content. It’s a powerful tool widely used in natural language processing (NLP) to make sense of large volumes of textual data. For instance, a text classifier can automatically sort emails into spam or not spam, determine the topic of a news article, or organize customer reviews by product category.

One specific application of text classification is sentiment analysis. Sentiment analysis focuses on identifying the emotional tone or attitude expressed in a piece of text. For example, it can determine whether a product review is positive, negative, or neutral.

To understand the difference, imagine analyzing a product review.

  • Sentiment Analysis would tell you how the customer feels , for example, whether the review expresses satisfaction or frustration.

  • A Text Classifier, on the other hand, could categorize the same review by product type  such as electronics, clothing, or furniture.

In essence, sentiment analysis is a type of text classification that focuses specifically on emotional polarity, while general text classification can encompass a much broader range of categories and purposes.

Before we start, if you are looking for help with a n8n project, we are taking on customers. Head over to our n8n Automation Engineer page.

 

 

Example 1 - Modifyng the System Prompt

A practical example of text classification can be seen in customer support systems, where incoming messages or tickets are automatically categorized and routed to the right department. This helps streamline responses and ensures customers get the assistance they need quickly.

First we grab the text classifier node

 

  • The Text Classifier analyzes the content of the message and determines its category , for example:
    we pass “App crashes on startup” as a parameter to the Text classifer node

    • Technical Support

    • Billing Question

    • Feature Request

    • General Inquiry

  • we also attach the AI model in this case, we use OpenAI Chat Model
  • Once classified, the message is automatically routed to the corresponding team or process for further handling.

Detailed view of the Text classifier

Example 2 - Chat message

Next, let’s use the same Text Classifier node but this time, we add a chat input.

The we ask the chat a question

The Text Classifer then figures out the appropriate category

Example 3 - Allow Multpile Classes to be True

Here, each example pairs a text input (a short message or headline) with one or more category tags that describe what type of content it is.

The classifier will learn from these examples so it can automatically tag new text messages in the future.

We are using four possible content categories:

  • Educational → Teaching content, tutorials, how-to guides, or learning resources

  • Promotional → encourages engagement, sales, or sign-ups

  • Time-Sensitive → has urgency or a time limit

  • Product-Related → talks about a product or its features

Text Classifier node

Example 4 - When No CLear Match

This is another example of  defining training data or labeling rules for a text classification workflow in n8n, This time for an email spam filter.

 

Text Classifier node

Example 5 - Changes to Different Models (Hugging Face)

Here, we us a different model in this case Hugging Face model.

https://huggingface.co/mrm8488/bert-tiny-finetuned-sms-spam-detection

we use a spam example model and make use of the HTPP node.

We use the Edit field node to send spam text to the Http Request node.

HTTP Request node

Final thought

The n8n text classifier node is a powerful tool for automating text categorization. By training it with clear, well-labeled examples, you can teach it to recognize patterns and assign relevant tags to new text automatically. In general, text classification helps organize and interpret large amounts of unstructured data, enabling smarter workflows, better content targeting, and faster decision-making across various use cases.

Thank you for reading this article. Make sure to check out our other n8n content on the website. If you need any help with n8n workflows we are taking on customers so reach out

Free Community

Join 1,000+ AI Automation Builders

Weekly tutorials, live calls & direct access to Ryan & Matt.

Join Free →

Keep Learning

n8n Date & Time Node

The Date & Time node in n8n might look simple at first glance, but it’s one of the most versatile tools for...

n8n information extractor node

When working with incoming data, it’s often essential to extract meaningful, structured information for further analysis or automation. The Information Extractor node...

n8n sentiment analysis node

Sentiment analysis is one of the most practical applications of artificial intelligence and natural language processing (NLP). It allows us to automatically...

n8n human in the loop

If you're building larger n8n workflows, you've probably hit a point where letting AI run completely unchecked isn't an option. Maybe you're...