The Sentiment Analysis node in n8n: classify any text by sentiment with AI
Published 5 August 2026 · 6 min read
Knowing whether a message expresses satisfaction, irritation or cold anger is the first building block of countless automations: alerting on a negative review, prioritizing a tense ticket, measuring the mood of a batch of NPS responses. It's a problem researchers have been working on for over twenty years — the reference survey by Bo Pang and Lillian Lee, Opinion Mining and Sentiment Analysis (2008, see on Google Scholar), already catalogued hundreds of works on the topic, back then built on lexicons and hand-trained classifiers. n8n's Sentiment Analysis node makes the operation trivial: give it a text and a chat model, and it routes each item to the branch matching its sentiment. This guide covers its configuration, its options, its limits, and when to prefer another node.
What the node actually does
Sentiment Analysis belongs to n8n's family of AI nodes (LangChain). How it works fits in one sentence: it submits the input text to a Chat Model connected as a sub-node, asks it to classify the text into one of the defined sentiment categories, and routes the item to the matching physical output. Three categories = three branches on the canvas, each ready to receive the next step of processing.
Example with the default categories:
Input: "Delivery four days late and customer service unreachable.
I won't recommend."
→ exits on the Negative branch
Input: "Order received, matches the description."
→ exits on the Neutral branch
Input: "Great team, problem solved in ten minutes!"
→ exits on the Positive branch
No prompt to write, no response parsing, no IF node behind it: the routing is wired into the node itself.
Minimal configuration
Two things are enough for a working node:
- Text to Analyze: the field to analyze, mapped as an expression —
{{ $json.body }}for an email,{{ $json.comment }}for a survey response,{{ $json.text }}for a review. - A connected Chat Model as a sub-node: OpenAI, Anthropic, Google Gemini, Mistral or a local model, as with every node in the family.
That's it. With the default categories (Positive, Neutral, Negative), the node is operational in under a minute.
Customizing sentiment categories
The Sentiment Categories field accepts a free-form, comma-separated list. Two ways to use it:
- Refine the scale:
Very Positive, Positive, Neutral, Negative, Very Negativeto distinguish a happy customer from an ambassador, or a disappointed one from a furious one. Useful when the reaction differs by intensity — a "Very Negative" triggers a phone call, a "Negative" an apology email. - Switch to action-oriented categories:
Urgent, Satisfied, At Riskfor a ticket stream,Enthusiastic, Lukewarm, Lostfor sales follow-up replies. The node remains a tone classifier, but the tone is expressed in your team's vocabulary, and each branch maps directly to a treatment.
Rule of thumb: three to five categories maximum, ordered along a coherent scale. Beyond that, the boundaries between neighboring categories blur and the model hesitates — the exact same phenomenon as an overly granular rubric in AI support ticket scoring.
The options that matter
Include Detailed Results. Off, the node just routes. On, it adds to the item the chosen category along with model-generated estimates of strength and confidence. The n8n documentation is clear about their status: they are rough indicators produced by the LLM, not calibrated probabilities. They remain very useful for one thing: routing low-confidence items to human review instead of deciding automatically.
System Prompt Template. Replaces the system prompt used for classification, with a {categories} placeholder to inject your categories. This is the lever for adding business context ("these texts are restaurant reviews; complaints about price alone count as Neutral") or forcing the analysis language. Only touch it when you actually need to: the default prompt is solid.
Enable Auto-Fixing. If the model returns a malformed output, the node automatically fires another call to fix it instead of failing. Cost: an occasional extra LLM call; benefit: far fewer failed executions, especially with small models. Leave it on in production.
Sentiment Analysis or Text Classifier?
The two nodes look alike — a text, an LLM, one branch per category — and the confusion is common. The difference lies in the nature of the categories:
- The Text Classifier classifies by arbitrary topics you describe freely: technical support, sales question, billing, spam. The question asked is "what is this text about?".
- Sentiment Analysis classifies along an opinion scale: the question is "what tone does this text express?", and the internal prompt is optimized for that.
The two combine very well in cascade: a Text Classifier sorts emails by topic, then a Sentiment Analysis on the "complaint" branch separates the annoyed customer from the one about to leave. And if you need to extract structured fields on top of the tone (product concerned, amount, specific request), add an Information Extractor on the relevant branch.
Which model, at what cost?
Sentiment classification on short texts is one of the tasks general-purpose LLMs are most comfortable with. The study by Zhang, Deng, Liu, Pan and Bing, Sentiment Analysis in the Era of Large Language Models: A Reality Check (NAACL 2024, see on Google Scholar), which evaluates LLMs across 26 datasets, concludes that they reach satisfactory zero-shot performance on simple sentiment classification — where they struggle is on fine-grained tasks like aspect-based analysis, which this node doesn't claim to do.
Practical consequence: a small model is enough — GPT-4o mini, Claude Haiku or equivalent — at a fraction of a cent per text. On 3,000 reviews per month, the difference between a premium and an economical model amounts to tens of euros for a marginal precision gain on this task. If volume becomes significant, measure real spend with our method for tracking AI call costs per workflow.
Four wired-up use cases
- Google reviews → Slack alert: the node classifies each new review, and the Negative branch triggers an immediate notification in a dedicated channel. The full pipeline — multi-source collection, aggregation, suggested replies — is detailed in our guide to analyzing customer reviews with AI.
- NPS responses: a detractor's verbatim goes to the relevant team, a promoter's feeds the testimonials pool. Our guide to analyzing NPS responses with AI shows how to cross-check the declared score against the sentiment of the free-text comment.
- Support tickets: a Sentiment Analysis at the head of the flow with
Urgent, Standard, At Riskcategories performs a first emotional triage before detailed scoring. - Social media mentions: on a stream of brand mentions, the Negative branch goes to human review while the rest aggregates into weekly statistics.
The pitfalls to know
- Short or ambiguous texts: "ok thanks" carries almost no signal; a model will classify it Neutral by default, sometimes Positive. Turn on Include Detailed Results and route low confidence to a human.
- Sarcasm and irony: "Well done, four days to answer an email" remains a hard case for every model. On streams where irony is frequent (social media), accept a residual error rate and keep a review loop.
- Multilingual input: LLMs classify most common languages correctly, but if your stream mixes languages, state in the System Prompt Template that sentiment must be assessed regardless of language — and test on a real sample.
- Large volumes and rate limits: a backlog of 10,000 reviews sent all at once will end in 429 errors. Pace it with Loop Over Items and Wait, as detailed in our article on AI API rate limits in n8n.
Summary
n8n's Sentiment Analysis node turns a task once reserved for NLP teams into a canvas block: a text as input, a connected Chat Model, one output branch per sentiment category — Positive/Neutral/Negative by default, or your own business gradations. The Include Detailed Results, System Prompt Template and Enable Auto-Fixing options cover production needs, and a small model is up to the task. To see it at work on a concrete end-to-end case, the AI Inbox Pack (€79) applies exactly this AI classification-and-routing logic to your email inbox: triage, prioritization by tone and urgency, and ready-to-approve reply drafts.
FAQ
Frequently asked questions
What is the difference between the Sentiment Analysis node and n8n's Text Classifier?
Both nodes classify text through an LLM and create one output branch per category, but the Text Classifier sorts by arbitrary topical categories (support, billing, spam…) while Sentiment Analysis sorts along an opinion scale (positive, neutral, negative, or your own gradations). If your question is "what is this text about?", use the Text Classifier; if it is "what tone or emotion does this text express?", use Sentiment Analysis.
Can I use categories other than Positive, Neutral and Negative?
Yes. The Sentiment Categories field accepts any comma-separated list: a finer scale (Very Positive, Positive, Neutral, Negative, Very Negative) or action-oriented business categories such as Urgent, Satisfied, At Risk. Each category becomes a physical output of the node — stay between three and five categories, beyond that the boundaries blur and classification gets less reliable.
Which model should I connect to the Sentiment Analysis node to keep costs under control?
Sentiment classification is a short, well-bounded task: an economical model such as GPT-4o mini or Claude Haiku is enough in the vast majority of cases, at a fraction of a cent per analyzed text. Save a more powerful model for genuinely ambiguous texts (sarcasm, reviews mixing positive and negative) and monitor spend with per-workflow cost tracking if volume grows.
Bundle FlowKit Complet
€269