Automate Twitter Sentiment Analysis with OpenAI, Google Sheets, and Slack Alerts

Go to Workflow
0 views
Built by InfyOm Technologies InfyOm Technologies
Created on June 07, 2026

Description

✅ 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?

Runs on a schedule to monitor Twitter mentions or hashtags.
Uses Apify to scrape tweets based on brand keywords.
Filters out tweets already processed (avoids duplicates).
Performs sentiment analysis with OpenAI (Positive, Neutral, Negative).
Logs tweet content, sentiment, and reply (if any) in a Google Sheet.
Sends an instant Slack notification for negative tweets.
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!

Nodes Used (7)

AI Agent
@n8n/n8n-nodes-langchain.agent
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
OpenAI
@n8n/n8n-nodes-langchain.openAi
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Slack
n8n-nodes-base.slack
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured