Back to Articles
Automations

n8n YouTube Comment Sentiment Analyzer: Automate Emotion Tracking in 2026

Build a free n8n workflow to analyze YouTube comment sentiment using Google Sheets, HTTP Request, and If nodes. Step-by-step guide with JSON template for marketers and developers.

Dev Shabbir
6 min read
2 views

n8n YouTube Comment Sentiment Analyzer: Automate Emotion Tracking in 2026

In 2026, manual comment monitoring on YouTube is obsolete. With n8n workflow automation, you can build a YouTube comment sentiment analyzer that processes hundreds of comments in seconds—categorizing them as positive, negative, or neutral—and storing insights directly in Google Sheets. Whether you're a content creator, agency, or enterprise marketer, this guide delivers a production-ready solution using only free tools.

What Is YouTube Comment Sentiment Analysis?

Sentiment analysis is the process of using natural language processing (NLP) to determine the emotional tone behind text. Applied to YouTube comments, it helps you:

  • Identify brand perception trends
  • Detect PR crises early
  • Measure campaign effectiveness
  • Prioritize community engagement

Without automation, analyzing thousands of comments weekly is impossible. That’s where n8n—a powerful open-source workflow automation platform—comes in.

Why Use n8n for This Workflow?

n8n outperforms alternatives like Zapier or Make for technical users because it offers:

Featuren8nZapierMake
CostFree self-hostedPaid plans requiredLimited free tier
Custom LogicIf, NoOp, SplitOut nodesBasic filtersVisual but rigid
Code AccessFull JSON export/importClosed systemPartial export
YouTube API DepthFull control via HTTP RequestLimited triggersModerate flexibility

For B2B agencies managing multiple clients or B2C creators scaling their presence, n8n provides unmatched flexibility at zero cost.

Required n8n Nodes Explained

This workflow uses six core n8n nodes. Here’s what each does:

1. Manual Trigger

Starts the workflow on demand—ideal for testing or scheduled runs.

2. HTTP Request Node

Calls the YouTube Data API v3 to fetch comments from any video using its ID.

3. SplitOut Node

Breaks the array of comments into individual items for per-comment processing.

4. If Node

Applies conditional logic—e.g., skip empty comments or filter by keyword.

5. Set Node

Formats data before output—adding timestamps, cleaning text, or enriching with metadata.

6. Google Sheets Node

Writes results to a spreadsheet with columns: Comment Text, Sentiment Score, Label, Timestamp.

Bonus: The NoOp node acts as a debug placeholder—useful during development to inspect data without side effects.

Step-by-Step Setup Guide

Step 1: Get Your YouTube API Key

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable YouTube Data API v3
  4. Create credentials → API key
  5. Restrict key to YouTube API only

Step 2: Prepare Your Google Sheet

Create a sheet with headers:
• Comment Text
• Sentiment Score
• Sentiment Label
• Video ID
• Timestamp

Share it with your n8n service account email (if using OAuth).

Step 3: Build the n8n Workflow

Follow this sequence:

  1. Manual Trigger → Input video ID
  2. HTTP Request → GET https://www.googleapis.com/youtube/v3/commentThreads
    Params: part=snippet&videoId={{$json["videoId"]}}&key=YOUR_API_KEY
  3. SplitOut → Split items array
  4. If Node → Condition: {{$json["snippet"]["topLevelComment"]["snippet"]["textDisplay"]}} !== ""
  5. HTTP Request (NLP) → POST to Google Natural Language API
    Body: {"document":{"type":"PLAIN_TEXT","content":"{{$json["snippet"]["topLevelComment"]["snippet"]["textDisplay"]}}"}}
  6. Set Node → Map fields:
    - Comment Text → NLP response
    - Sentiment Score → documentSentiment.score
    - Label → IF(score > 0.25, "Positive", IF(score < -0.25, "Negative", "Neutral"))
  7. Google Sheets → Append row

Pro Tip: Add a Sticky Note node labeled “Error Handling” to document rate limits (YouTube API allows ~10,000 units/day).

Step 4: Import the Free JSON Template

Skip manual setup—import our pre-built workflow:

Click to expand n8n JSON template
{
  "nodes": [
    {
      "parameters": { "triggerMode": "manual" },
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger"
    },
    {
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/commentThreads",
        "method": "GET",
        "parameters": {
          "part": "snippet",
          "videoId": "={{$json[\"videoId\"]}}",
          "key": "YOUR_API_KEY"
        }
      },
      "name": "Fetch YouTube Comments",
      "type": "n8n-nodes-base.httpRequest"
    },
    {
      "parameters": { "fieldToSplitOut": "items" },
      "name": "Split Comments",
      "type": "n8n-nodes-base.splitOut"
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"snippet\"][\"topLevelComment\"][\"snippet\"][\"textDisplay\"]}}",
              "operation": "isEmpty",
              "value2": false
            }
          ]
        }
      },
      "name": "Filter Empty Comments",
      "type": "n8n-nodes-base.if"
    },
    {
      "parameters": {
        "url": "https://language.googleapis.com/v1/documents:analyzeSentiment",
        "method": "POST",
        "bodyParameters": {
          "document.type": "PLAIN_TEXT",
          "document.content": "={{$json[\"snippet\"][\"topLevelComment\"][\"snippet\"][\"textDisplay\"]}}"
        },
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleApi"
      },
      "name": "Analyze Sentiment",
      "type": "n8n-nodes-base.httpRequest"
    },
    {
      "parameters": {
        "values": {
          "string": [
            { "name": "Comment Text", "value": "={{$json[\"documentSentiment\"]}}" },
            { "name": "Sentiment Score", "value": "={{$json[\"documentSentiment\"][\"score\"]}}" },
            { "name": "Sentiment Label", "value": "={{ $json[\"documentSentiment\"][\"score\"] > 0.25 ? \"Positive\" : ($json[\"documentSentiment\"][\"score\"] < -0.25 ? \"Negative\" : \"Neutral\") }}" }
          ]
        }
      },
      "name": "Format Output",
      "type": "n8n-nodes-base.set"
    },
    {
      "parameters": {
        "operation": "append",
        "sheetId": "YOUR_SHEET_ID",
        "range": "A:E"
      },
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets"
    }
  ],
  "connections": { /* ... */ }
}

Download the full JSON file here (GitHub link).

Advanced: Add Error Handling & Scalability

For production use:

  • Rate Limiting: Add a NoOp node with a 1-second delay between NLP calls to avoid 429 errors.
  • Empty Responses: Use the If node to check documentSentiment exists before writing to Sheets.
  • Multi-Video Support: Replace Manual Trigger with Cron schedule + Google Sheets input (video IDs in column A).

B2B Use Cases: Agency & Enterprise Applications

Agencies managing 50+ client channels use this workflow to:
• Generate weekly sentiment reports
• Trigger Slack alerts for negative spikes
• Feed data into BI tools (Looker, Tableau)
• Benchmark against competitors

Enterprises integrate it with CRM systems to track product launch feedback in real time.

FAQ: People Also Ask

Q: Can n8n analyze YouTube comment emotions (not just positive/negative)?
A: Yes—replace Google NLP with AWS Comprehend or Azure Text Analytics for granular emotions (joy, anger, fear).

Q: Is this workflow free?
A: Absolutely. n8n is open-source, and Google NLP offers 5,000 free units/month. YouTube API costs are negligible (<$1/month for 100 videos).

Q: How accurate is the sentiment analysis?
A: Google NLP achieves ~85% accuracy on short social text. For higher precision, fine-tune with domain-specific training data.

Automation

Automate this with Workflows

Ready-to-use n8n templates designed to implement the strategies discussed in this article instantly.

Explore Library

Continue Reading

Deepen your knowledge with related articles

All Articles