Skip to main content

Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts

Workflow preview

Workflow preview
100%
Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What problem does this workflow solve? Tracking what people say about your brand on Twitter can be overwhelming, especially when important mentions slip through the cracks. This workflow automate...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.openai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.googlesheets, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.switch, n8n-nodes-base.scheduletrigger, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by InfyOm Technologies.

Original n8n.io source

1.1 Workflow description

Title
Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts
Workflow name
Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts

βœ… What problem does this workflow solve?

Tracking what people say about your brand on Twitter can be overwhelming, especially when important mentions slip through the cracks. This workflow automates the process: it scrapes Twitter mentions, analyzes sentiment using OpenAI, logs everything in a Google Sheet, and sends real-time Slack alerts for negative tweets. No manual monitoring needed.


βš™οΈ What does this workflow do?

  1. Runs on a schedule to monitor Twitter mentions or hashtags.
  2. Uses Apify to scrape tweets based on brand keywords.
  3. Filters out tweets already processed (avoids duplicates).
  4. Performs sentiment analysis with OpenAI (Positive, Neutral, Negative).
  5. Logs tweet content, sentiment, and reply (if any) in a Google Sheet.
  6. Sends an instant Slack notification for negative tweets.
  7. Generates thank-you replies for positive tweets and logs them.

πŸ”§ Setup Instructions

πŸ—“ Schedule Trigger

  • Use the Cron node to schedule checks (e.g., every hour, daily).

🐦 Apify Twitter Scraper Setup

  • Sign up on Apify
  • Generate your Apify API Token and use it in the HTTP node to run the actor and get tweet results.

πŸ€– OpenAI Sentiment Analysis

  • Get your API key from OpenAI

πŸ“„ Google Sheet Configuration

Prepare a Google Sheet with this sample format.

Connect it using the Google Sheets node in n8n.

πŸ’¬ Slack Notifications

  • Connect your Slack workspace via the Slack node.
  • Set up the channel where negative tweets should be sent as alerts.

🧠 How it Works

1. Scheduled Run

Triggered at a fixed interval using the Schedule (Cron) node.

2. Scrape Mentions from Twitter

  • The Apify actor runs and collects recent tweets mentioning your brand or using your hashtag.
  • Links to the tweets are extracted.

3. Filter Previously Seen Tweets

  • Each tweet is checked against the Google Sheet.
  • If already present, it’s skipped to avoid duplicate analysis.

4. Analyze Sentiment with OpenAI

  • For new tweets, sentiment is classified into:
    • βœ… Positive
    • βšͺ Neutral
    • ❌ Negative

5. Store Results in Google Sheet

  • The tweet link, content, and sentiment are stored in a row.
  • If sentiment is positive, a thank-you reply is also generated and saved.

6. Notify Slack for Negative Tweets

  • When a tweet is tagged Negative, a Slack message is sent to the designated channel with the tweet link.

πŸ‘€ Who can use this?

This workflow is ideal for:

  • πŸ“’ Social Media Teams
  • 🧠 PR and Brand Managers
  • πŸ§‘β€πŸ’» Solo Founders
  • 🏒 Startups & SaaS Companies

Stay ahead of your brand's reputationβ€”automatically.


πŸ›  Customization Ideas

  • 🎯 Add filters for specific campaign hashtags.
  • πŸ“¬ Send weekly summary reports via email.
  • πŸ“₯ Auto-open support tickets for negative mentions.
  • πŸ—£ Expand sentiment categories with more detailed tagging.

πŸš€ Ready to get started?

Just plug in:

  • πŸ”‘ Your Apify API Token
  • πŸ”‘ Your OpenAI API Key
  • πŸ“„ Your Google Sheet
  • πŸ’¬ Your Slack Channel

Then deploy the workflow, and let it monitor Twitter for you!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 2 - OpenAI

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 3 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 4 - Get Post Data

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 5 - Sentiment Analyst

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 6 - Switch According Analyst

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 7 - Add Post Data

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 8 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 9 - Set Field for Loop

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 10 - Send negative post message on slack

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 11 - Request for Twitter Post via Apify

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 12 - Get Requested Post from Apify

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 13 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 15 - If Duplicate

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

3. Summary Table

Workflow Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts
Complexity advanced
Nodes 15
Categories Market Research, AI Summarization
Author InfyOm Technologies
Published 18 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6119/6119.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate Twitter sentiment analysis with OpenAI, Google Sheets, and Slack alerts do?

What problem does this workflow solve? Tracking what people say about your brand on Twitter can be overwhelming, especially when important mentions slip through the cracks. This workflow automate...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Market Research, AI Summarization use case.