π Analyze social media sentiment & trends from Twitter & Facebook using GPT-4o
β‘ 226 views Β· π Market Research & Insights
π‘ Pro Tip β Twitterβs API is paid now, which makes simple data pulls expensive. ScraperNode is a community node that scrapes Twitter profiles and posts without needing API access.
Description
Description
Gain real-time audience intelligence with this cross-platform AI Sentiment Analyzer for Twitter (X) and Facebook. ππ§ This workflow consolidates mentions and comments, performs GPT-4o-powered sentiment and keyword analysis, summarizes audience mood, highlights dominant trends, and sends a polished HTML report via email β all automatically. Ideal for marketing and insights teams tracking brand conversations across social platforms. ππ¬
What This Template Does
1οΈβ£ Starts manually to fetch the latest Twitter mentions and Facebook post comments. πΉοΈ 2οΈβ£ Merges both datasets into a unified JSON structure for seamless cross-platform analysis. π§© 3οΈβ£ Validates incoming API data to ensure completeness before processing. β 4οΈβ£ Runs a custom JavaScript transformation to normalize all messages and add sentiment placeholders. π§ 5οΈβ£ Uses GPT-4o to perform sentiment and keyword trend analysis, returning structured JSON insights. π 6οΈβ£ Parses AI output to extract overall sentiment ratios and detailed post-level analysis. π 7οΈβ£ Generates a human-readable HTML summary using GPT-4o β featuring emojis, bullet insights, and trend sections. π¨ 8οΈβ£ Emails the formatted sentiment report directly to the marketing team. βοΈ 9οΈβ£ Logs API or runtime errors automatically into Google Sheets for transparent monitoring. π§Ύ
Key Benefits
β Provides an automated end-to-end pipeline for sentiment intelligence. β Centralizes Twitter and Facebook audience data in one workflow. β Delivers structured insights ready for dashboards or client reporting. β Generates branded HTML summaries that are ready for emailing. β Improves reliability with built-in error tracking and validation layers.
Features
- Dual-platform integration (Twitter X API + Facebook Graph API).
- JavaScript logic for merging and normalizing social datasets.
- GPT-4o-based sentiment classification and keyword extraction.
- Structured JSON parsing and visualization pipeline.
- AI-generated HTML summary reports for presentation and sharing.
- Automated email dispatch via Gmail.
- Google Sheets logging for audit and debugging.
- Modular configuration β easily extendable to other social networks.
#3 Requirements
- Twitter OAuth2 credentials for fetching mentions.
- Facebook Graph API credentials for reading posts and comments.
- Azure OpenAI (GPT-4o) credentials for sentiment and summary generation.
- Gmail OAuth2 credentials for automated email delivery.
- Google Sheets OAuth2 credentials for error logging and tracking.
Environment Variables
- TWITTER_API_KEY
- FACEBOOK_GRAPH_TOKEN
- AZURE_OPENAI_API_KEY
- GMAIL_REPORT_RECIPIENTS
- GOOGLE_SHEET_ERROR_LOG_ID
Target Audience
π Marketing and insights teams monitoring audience engagement. π¬ Social media managers analyzing public sentiment. π§ Data analysts exploring brand perception trends. π‘ PR and communications teams managing online reputation. π§Ύ Operations or automation teams integrating AI analytics into dashboards.
Step-by-Step Setup Instructions
1οΈβ£ Connect all API credentials β Twitter, Facebook Graph, Azure OpenAI, Gmail, and Google Sheets. 2οΈβ£ Update your Twitter user ID and Facebook Page ID in the respective nodes. 3οΈβ£ Confirm the merge and validation logic in the Merge Platform Datasets and Validate API Response nodes. 4οΈβ£ Check that your Azure OpenAI account has GPT-4o access enabled. 5οΈβ£ Verify the Gmail recipient and test the βSend Email Summaryβ node for delivery. 6οΈβ£ Link your Google Sheet with a tab named error log sheet to capture workflow exceptions. 7οΈβ£ Run the workflow once manually to validate each layer β data, AI response, email delivery. 8οΈβ£ Optionally, schedule it to run daily or weekly for automated sentiment insights. β
π Nodes Used
Google Sheets, HTTP Request, Facebook Graph API, Gmail, AI Agent, Azure OpenAI Chat Model
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File