Automate Twitter Sentiment Analysis and Data Enrichment
detail.loadingPreview
Streamline your social media monitoring by automatically fetching tweets, analyzing their sentiment with AI, and storing the data for further analysis. Get instant notifications for high-impact tweets and build a comprehensive understanding of public opinion.
About This Workflow
This n8n workflow is a powerful ETL pipeline designed to automate the process of gathering and analyzing Twitter data. It begins by scheduling a daily fetch of tweets containing the hashtag #OnThisDay. These tweets are then stored in MongoDB for efficient access. Leveraging Google Cloud Natural Language, the workflow analyzes the sentiment of each tweet, extracting a sentiment score and magnitude. This enriched data is then passed to a 'Set' node to prepare it for storage in PostgreSQL and subsequent conditional actions. The pipeline facilitates a data-driven approach to understanding public discourse and brand perception.
Key Features
- Scheduled Twitter Data Fetching: Automatically collects tweets based on a specified hashtag at a set interval.
- AI-Powered Sentiment Analysis: Utilizes Google Cloud Natural Language to determine the emotional tone and strength of tweets.
- Multi-Database Integration: Seamlessly stores raw and enriched tweet data in both MongoDB and PostgreSQL.
- Conditional Notifications: Triggers alerts via Slack for tweets exceeding a certain sentiment score, keeping you informed of significant conversations.
- Data Enrichment for Deeper Insights: Adds sentiment score and magnitude to tweet data, enabling more sophisticated analysis.
How To Use
- Configure Cron Node: Set your desired schedule for fetching tweets (e.g., daily at 6 AM).
- Set Up Twitter Credentials: Authenticate your n8n instance with your Twitter API credentials.
- Configure Twitter Node: Specify the search text (e.g., '#OnThisDay') and limit the number of tweets to fetch.
- Set Up MongoDB Credentials: Connect n8n to your MongoDB instance and define the collection name (e.g., 'tweets').
- Configure MongoDB Node: Set the operation to 'insert' and specify the fields to save.
- Set Up Google Cloud Natural Language Credentials: Authenticate n8n with your Google Cloud API credentials.
- Configure Google Cloud Natural Language Node: Map the tweet text from the MongoDB node to the 'content' parameter.
- Configure Set Node: Map the sentiment score and magnitude from the Google Cloud Natural Language node and the original tweet text from the Twitter node to new fields.
- Set Up PostgreSQL Credentials: Connect n8n to your PostgreSQL database and define the table name (e.g., 'tweets').
- Configure PostgreSQL Node: Select the table, specify the columns to insert, and set 'returnFields' to '*'.
- Configure IF Node: Set the condition to check if the 'score' is greater than a desired threshold (e.g., 0.5 for positive sentiment).
- Set Up Slack Credentials: Authenticate n8n with your Slack API credentials.
- Configure Slack Node: Define the channel, and craft a message using the sentiment score, magnitude, and tweet text.
- Configure NoOp Node: This node acts as a placeholder for workflows that don't meet the IF condition.
Apps Used
Workflow JSON
{
"id": "71c4aa0d-3d80-4764-bac0-3390b895633c",
"name": "Automate Twitter Sentiment Analysis and Data Enrichment",
"nodes": 18,
"category": "Marketing",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 71c4aa0d-3d80...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Automated Multi-Platform Social Media Publisher
Streamline your social media content creation and publishing with this n8n workflow. Simply fill out a web form with your caption, media (image or video), and target platforms, and let n8n automate the posting process across multiple social networks.
WhatsApp AI Assistant: LLaMA 4 & Google Search for Real-Time Insights
Instantly deploy a smart AI assistant on WhatsApp, powered by Groq's lightning-fast LLaMA 4 model. This workflow enables real-time conversations, remembers context, and provides up-to-date answers by integrating live Google Search results.
AI-Powered On-Page SEO Audit & Report Automation
Instantly generate comprehensive on-page SEO technical and content audits for any website URL. This AI-powered workflow automates the entire process, from scraping the page to delivering a detailed report directly to your inbox, empowering you to optimize for better search rankings and user engagement.