Automated Twitter Sentiment Analysis & Slack Alert Workflow
High-Level Summary
This workflow automatically monitors Twitter (X) for posts containing a specific keyword, analyzes their sentiment using OpenAI, and takes conditional actions based on the result. It is designed to help social media managers, marketers, and customer support teams track brand mentions or event-related tweets in real-time. The workflow fetches tweets via the Apify X Posts Search API, checks for duplicates in a Google Sheet, performs sentiment analysis with GPT-4o-mini, and then either generates a positive reply, sends a Slack alert for negative tweets, or logs neutral tweets for future reference. All data is stored in Google Sheets for auditability.
Step-by-Step Node Breakdown
-
Schedule Trigger — Runs the workflow every 6 hours. No auth required. The trigger is set to a 6-hour interval, ensuring regular monitoring without overwhelming API quotas.
-
Request for Twitter Post via Apify — Makes a POST request to the Apify API to search for tweets. API Key auth using query parameter token. It sends a JSON body with the query "LaraconIn", fetching 5 latest English tweets. This node will continue on error if the API fails.
-
Get Requested Post from Apify — Makes a GET request to retrieve the results from the Apify run. API Key auth using query parameter token. It fetches the dataset items from the most recent Apify run.
-
Set Field for Loop — Renames incoming JSON fields to standardized names (id, tweet_url, tweet_text). No auth. This ensures downstream nodes receive consistent field names regardless of API response structure.
-
Loop Over Items — Iterates over each tweet item. No auth. This split-in-batches node processes tweets one by one, enabling per-tweet actions.
-
Get Post Data — Queries Google Sheets to check if a tweet already exists. OAuth2 auth (Google Sheets). It looks up the tweet ID in column "ID" to detect duplicates.
-
If Duplicate — Checks if the tweet ID exists in the sheet. No auth. If the ID exists (true branch), the item is skipped to avoid duplicates. If not (false branch), the tweet proceeds to sentiment analysis.
-
OpenAI Chat Model — Provides the GPT-4o-mini language model for sentiment analysis. API Key auth (OpenAI). This node supplies the AI model to the Sentiment Analyst agent.
-
Structured Output Parser — Parses the sentiment result into structured JSON with a "category" field. No auth. It expects output in the format
{"category": "neutral"}to ensure consistent data for the switch node. -
Sentiment Analyst — Analyzes tweet text sentiment using GPT-4o-mini. No auth (uses the OpenAI Chat Model node). It classifies each tweet as Positive, Negative, or Neutral based on the system prompt.
-
Switch According Analyst — Routes tweets based on their sentiment category. No auth. Three outputs:
- Positive: Routes to OpenAI for reply generation
- Negative: Routes to Slack for alerting
- Neutral: Routes directly to Google Sheets logging
-
OpenAI — Generates a user-style reply for positive tweets. API Key auth (OpenAI). It uses GPT-4o-mini to craft a short, friendly, emoji-free reply under 160 characters, directed at the original poster.
-
Send negative post message on slack — Sends a Slack message for negative tweets. OAuth2 auth (Slack). Posts to the #website-uptime channel with the tweet URL and a notification that action may be needed.
-
Add Post Data — Writes all tweet data back to Google Sheets. OAuth2 auth (Google Sheets). Appends or updates the row with Tweet ID, URL, text, sentiment, and the generated reply (if any). Matching is done on the ID column.
Setup Instructions
To use this workflow, you need accounts and credentials for the following services:
Prerequisites
- Apify API Token (free tier available) — Sign up at apify.com and get your token from Settings > API & Integrations. Replace
api_keyin both HTTP Request URLs with your actual token. - OpenAI API Key — Sign up at platform.openai.com and create a project API key with access to GPT-4o-mini.
- Google Sheets API — You need a Google Cloud Project with the Sheets API enabled. n8n provides OAuth2 credential setup for Google Sheets.
- Slack App — Create a Slack app at api.slack.com with the
chat:writescope and install it to your workspace. Channel IDC090F70N52Mmust be replaced with your actual channel. - n8n instance — Self-hosted or cloud (n8n.io).
Configuration
- Google Sheet: Create a sheet with columns: ID, TweetUrl, TweetText, Sentiment , Post Reply. Update the
documentIdandsheetNamein both Google Sheets nodes. - Search Query: In the "Request for Twitter Post via Apify" node, change
queryfrom "LaraconIn" to your desired keyword/hashtag. - Schedule: Adjust the interval in the Schedule Trigger node as needed.
Use Cases & Variations
This workflow is highly adaptable. Consider these variations:
Use Cases
- Brand Monitoring: Track your company name or product mentions on Twitter, instantly alerting customer support to negative tweets.
- Event Tracking: Monitor hashtags for conferences (like #LaraconIn) to engage with attendees and gather feedback.
- Competitor Analysis: Track competitor product launches or campaigns to understand public sentiment.
Customizations
- Modify Sentiment Categories: Change the system prompt in Sentiment Analyst to detect urgency, spam, or specific topics.
- Add More Outputs: Route positive tweets to a Slack celebration channel, or negative tweets to a ticketing system like Jira.
- Different AI Models: Swap GPT-4o-mini for Claude or Gemini by changing the language model node.
- Expand Data Sources: Replace Apify with other Twitter scrapers or RSS feeds from social media listening tools.
- Add Human Review: Insert a manual approval step before sending replies to ensure brand safety.
Workflow JSON
{
"name": "Twitter Monitoring Workflow",
"nodes": [
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
-60,
210
],
"id": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
"name": "Loop Over Items"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "GPT-4O-MINI"
},
"messages": {
"values": [
{
"content": "={{ $('Set Field for Loop').item.json.tweet_text }}"
},
{
"content": "=You are a professional Twitter social media user replying to the original poster (admin).\n\nAnalyze the sentiment of the tweet below. If the sentiment is positive, write a short, thoughtful reply **from a user's perspective**, directed to the person who posted it.\n\nThe reply should:\n- Show appreciation, agreement, or excitement\n- Be friendly, intelligent, and relevant to tech or AI fields\n- Use no emojis\n- Be under 160 characters\n- Address the original poster directly as a real person would\n\nTweet:\n\"\"\"\nuse a user prompt\n\"\"\"",
"role": "system"
}
]
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
1380,
-220
],
"id": "dec03e00-a5fa-44eb-b269-b486259ac1aa",
"name": "OpenAI",
"credentials": {
"openAiApi": {
"id": "ga54eHkT3k6225Zq",
"name": "OpenAi account"
}
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
AI Viral Video Creator from Telegram with Voice & Multi-Platform Posting
🚀 Automatically Generate and Publish Viral TikTok-Style Videos from a Simple Telegram Message This workflow transforms a single Telegram message containing a photo and a theme (caption) into a fully-produced, AI-generated talking-head video optimized for viral social media content. It leverages Perplexity for trend research, OpenAI GPT-4 for script and caption generation, ElevenLabs for realistic voice synthesis, and FAL.ai's VEED Fabric model to create a lip-synced avatar video from the photo. The final video, along with an engaging caption and relevant hashtags, is saved to Google Sheets for tracking and then automatically published to up to nine social media platforms—TikTok, YouTube, Instagram, LinkedIn, Facebook, Twitter (X), Threads, Pinterest, and Bluesky—via the Blotato integration. This is an end-to-end content creation pipeline perfect for creators, marketers, and businesses who want to maintain a consistent, high-frequency posting schedule without manual video editing. It reduces the time from idea to published video to under 5 minutes. 📋 Node-by-Node Breakdown Telegram Trigger (Telegram Bot Token) — Listens for incoming messages containing a photo and caption. The trigger activates on updates. No additional filtering is applied; every photo with a caption will start the workflow. Workflow Configuration (No auth) — A static Set node that stores API keys and configuration values (ElevenLabs API key, voice ID, FAL API key, and the Perplexity model name) as workflow variables for easy maintenance. Extract Photo and Theme (No auth) — Extracts the largest photo file ID from the Telegram message and the caption (or text) as the theme. Falls back to "viral content" if no caption is provided. Get Photo File from Telegram (Telegram Bot Token) — Uses the Telegram Bot API to download the photo file specified by the file ID extracted in the previous step. Build Public Image URL (No auth) — Uploads the downloaded photo to to obtain a publicly accessible URL. This URL is later used by FAL.ai's VEED Fabric model. Search Trends with Perplexity (Perplexity API key) — Sends a query to Perplexity AI asking for the top 3 current viral trends related to the user's theme. The model is configured dynamically from the workflow configuration node. Generate Script with GPT-4 (OpenAI API key) — Uses OpenAI GPT-4o-mini to generate a 30-second TikTok script based on the trends found by Perplexity and the original theme. The prompt enforces a hook in the first 2 seconds and conversational tone. ElevenLabs Voice Synthesis (API key in header) — Sends the generated script to ElevenLabs' text-to-speech API with the configured voice ID, producing an MP3 audio file. Uses header for authentication. Convert .mpga to .mp3 (No auth) — A JavaScript Code node that renames the binary audio file from to and sets the correct MIME type, ensuring compatibility with downstream nodes. Upload Audio to Public URL (No auth) — Uploads the MP3 audio to to make it publicly accessible for FAL.ai. FAL.ai Video Generation (API key in header) — Sends a request to FAL.ai's VEED Fabric 1.0 endpoint with the public image URL and audio URL to generate a talking-head lip-sync video at 480p resolution. Authentication uses the header with the FAL API key. Wait for VEED (No auth) — A Wait node that pauses execution for 10 minutes to allow the video generation to complete. The node uses polling via webhook (not active here) but is configured as a timed wait. Download VEED Video (API key in header) — Periodically queries the FAL.ai request status endpoint (using the request ID from the generation response) to retrieve the completed video URL. Generate Caption with GPT-4 (OpenAI API key) — A second OpenAI node that creates an engaging TikTok caption with trending hashtags based on the same theme and trends. Outputs only the caption text. Save to Google Sheets (Google Sheets OAuth2) — Appends a new row to a Google Sheet with columns: IDEA (original theme), CAPTION, AUDIO URL, IMAGE URL, VIDEO URL. The sheet and document ID are expected to be configured via resource locator or expression. Send a video (Telegram Bot Token) — Sends the generated video back to the original Telegram chat as a confirmation. Upload Video to BLOTATO (Blotato API key) — Uploads the video file to Blotato's media storage, obtaining a hosted URL for distribution. TikTok / YouTube / LinkedIn / Facebook / Instagram / Twitter (X) / Threads / Bluesky / Pinterest (Blotato API key) — Nine parallel Blotato nodes that each publish the video to their respective social media accounts. Each node uses pre-configured account IDs (list mode) and the generated caption. YouTube optionally sets the video to "private" and disables subscriber notifications. Merge1 (No auth) — A Choose Branch merge node that waits for all nine social media publishing branches to complete before continuing. Update Status to "DONE" (Google Sheets OAuth2) — Updates the corresponding row in the Google Sheet (matched by video URL) to set the STATUS column to "DONE". 🔧 Setup Instructions To use this workflow, you'll need the following accounts and API keys: Telegram — Create a bot via @BotFather and get the bot token. Use it in the Telegram Trigger and Telegram nodes. ElevenLabs — Sign up at elevenlabs.io, generate an API key, and clone or select a voice. Note the Voice ID. FAL.ai — Sign up at fal.ai, create an API key from the dashboard. The workflow uses the VEED Fabric 1.0 model – no separate VEED subscription is needed. Perplexity AI — Sign up at perplexity.ai, get an API key from settings. OpenAI — Sign up at platform.openai.com, create an API key with access to GPT-4o-mini. Google Sheets — Create a Google Sheet with the required columns (IDEA, URL IMAGE, URL AUDIO, URL VIDEO, CAPTION, STATUS). Set up Google Sheets OAuth2 credentials in n8n. Blotato — Sign up at blotato.com, get an API key from settings. Install the community node in n8n (Settings → Community Nodes). Connect each social media account within Blotato to obtain account IDs. tmpfiles.org — No account required; the service is used for temporary file hosting. After obtaining all keys, update the Workflow Configuration node with your values and configure credentials for each API node (Telegram, Perplexity, OpenAI, Google Sheets, Blotato). The sticky notes in the canvas provide step-by-step visual guidance. 💡 Use Cases & Variations Content Repurposing: The workflow can be adapted to repurpose a blog post or article into a short video by feeding the text as a theme. Brand Voice: Customize the ElevenLabs voice to match your brand's tone. Trend-Driven Campaigns: Use Perplexity with different prompts to focus on niche topics (e.g., "tech startups", "healthy recipes"). Platform-Specific Formatting: Modify the caption generation prompt to include platform-specific elements (e.g., LinkedIn professional tone, Twitter character limit). Scheduling: Add a Schedule Trigger to run the workflow periodically with pre-defined themes from a spreadsheet instead of Telegram. Analytics: Extend the Google Sheet with additional columns for engagement metrics by integrating with social media analytics APIs. This workflow is fully modular; you can remove any of the Blotato publishing nodes if you only need specific platforms.
Generate Videos & Carousels with Blotato, Publish to Instagram & TikTok
Overview This workflow creates a fully autonomous AI-powered social media content pipeline. It listens for incoming Telegram messages containing a public URL (YouTube video, article, Instagram post, etc.) and a target platform (Instagram or TikTok). The AI agent then extracts the content, generates a custom visual using Blotato's AI tools, waits for the visual to be fully rendered, publishes it to the specified social media account, and finally sends a confirmation message back to the user on Telegram. This eliminates the manual work of content repurposing, design, and cross-platform posting. This is ideal for content creators, marketers, and businesses who want to repurpose long-form content into short-form social media posts automatically. The AI handles the entire decision-making and execution process, making it a true "set and forget" automation. Workflow Steps Telegram Trigger (No auth) — Listens for incoming Telegram messages. Configured to capture all updates. This is the entry point; the user sends a URL and a platform request (e.g., "Post this YouTube video to Instagram"). Social Media Autopilot (AI Agent, uses OpenAI & Blotato tools) — The core AI agent. It receives the Telegram message text and uses a detailed system prompt to orchestrate the entire pipeline. It decides which tools to call and in what order. The agent uses: - OpenAI ChatGPT (API Key auth) — The language model powering the agent's reasoning. Uses model. - Simple Memory (No auth) — A buffer memory that stores the last 35 conversation turns, allowing the agent to maintain context across multiple tool calls (e.g., polling for status). Create source (Blotato API Key auth) — Takes the extracted URL from the user's message and creates a content source in Blotato. This fetches and processes the content from the URL (e.g., extracts article text, video transcript). Get source (Blotato API Key auth) — Polls the source created in step 3 until its becomes . This ensures the content is fully extracted before proceeding. Create visual - tweet card carousel (Blotato API Key auth) — Used when the target platform is Instagram. Generates a carousel of tweet-style quote cards using a predefined template. Configured with a default profile image, author name, and handle. Create visual - AI image video (Blotato API Key auth) — Used when the target platform is TikTok. Generates an AI-powered video with scenes, voiceover, and captions. Configured with a deep American voice (Brian) and the Recraft v3 AI image model. Get visual (Blotato API Key auth) — Polls the visual generation job until its is exactly . This is critical to ensure the media is fully rendered before publishing. Post to Instagram (Blotato API Key auth) — Publishes the generated carousel to the connected Instagram account (). Uses the media URLs from the completed visual. Post to TikTok (Blotato API Key auth) — Publishes the generated video to the connected TikTok account (). Uses the media URL from the completed visual. Send notification (Telegram Bot Token auth) — Sends a confirmation message back to the original Telegram chat, confirming successful publication (e.g., "✅ Published successfully on Instagram."). Setup Instructions To use this workflow, you will need: n8n instance — Self-hosted or cloud (n8n.cloud). Blotato account — Sign up at blotato.com and get your API key. Connect your Instagram and TikTok accounts inside Blotato. Telegram Bot — Create a bot via @BotFather and get the bot token. This is used for both the trigger and the notification. OpenAI API key — Required for the AI agent. Get one from platform.openai.com. Configuration steps: Import the workflow JSON into n8n. Add your Blotato API credentials as a credential of type "Blotato API". Add your OpenAI API key as a credential of type "OpenAI". Add your Telegram Bot token as a credential of type "Telegram Bot API". In the Post to Instagram and Post to TikTok nodes, select the correct Blotato-connected accounts from the dropdown. Activate the workflow. Use Cases & Variations Content Repurposing: Automatically turn YouTube videos into TikTok clips or blog posts into Instagram carousels. Multi-Platform Posting: Extend the workflow to post to other platforms like LinkedIn, Facebook, or Twitter by adding more Blotato post nodes. Scheduled Digests: Replace the Telegram trigger with a Schedule trigger to automatically process a list of URLs from a Google Sheet or RSS feed. Brand Customization: Modify the carousel template ID and video settings (voice, model, colors) to match your brand guidelines. Approval Workflow: Add a manual approval step (e.g., a Slack message with buttons) before publishing, giving you control over what goes live.
Low Cost AI Videos with Veo3 Fast for YouTube/TikTok
AI Video Generation & Social Media Upload Workflow This workflow automates the process of generating AI-powered videos using Google's Veo3 Fast model, saving them to Google Drive, generating SEO-optimized titles with GPT-4o, and automatically uploading them to YouTube and TikTok. It's designed for content creators, marketers, and social media managers who want to streamline their video production pipeline from a single Google Sheet interface. The workflow is triggered by a Google Sheet that acts as a central command center. You simply add your video prompts and desired durations to the sheet, and the workflow handles everything else — from video generation to multi-platform publishing. This eliminates manual downloading, renaming, and uploading steps, saving hours of repetitive work. Node-by-Node Breakdown When clicking 'Test workflow' (Manual Trigger) — No auth. Starts the workflow manually for testing purposes. Useful for initial setup and debugging. Schedule Trigger — No auth. Runs the workflow on a recurring schedule. Currently configured to run every 5 minutes (interval-based on minutes). Get new video (Google Sheets) — OAuth2 (Google). Reads rows from a Google Sheet where the "VIDEO" column is empty, indicating new video requests. The sheet must have columns: PROMPT, DURATION, VIDEO, YOUTUBEURL, and rownumber. Set data (Set) — No auth. Combines the PROMPT and DURATION fields from the sheet into a single prompt string that will be sent to the AI video generation API. Create Video (HTTP Request) — Header Auth (Authorization: Key YOURAPIKEY). Sends a POST request to the Veo3 Fast API endpoint () with the combined prompt as JSON body. Returns a for polling. Wait 60 sec. (Wait) — No auth. Pauses execution for 60 seconds to allow the video generation to complete before checking status. Get status (HTTP Request) — Header Auth (same as above). Polls the Veo3 Fast API status endpoint using the from step 5 to check if video generation is complete. Completed? (IF) — No auth. Checks if the status returned is "COMPLETED". If yes, proceeds to fetch the video URL. If not, loops back to wait another 60 seconds and check again. Get Url Video (HTTP Request) — Header Auth (same as above). Once completed, fetches the full video details including the download URL from the Veo3 API. Generate title (OpenAI) — API Key auth (OpenAI). Uses GPT-4o-mini to generate an SEO-optimized YouTube title (max 60 characters) based on the original prompt. The AI is instructed to match the language of the input and output only the title. Get File Video (HTTP Request) — No auth. Downloads the actual video file from the URL provided by Veo3. This binary data is used for uploading. Upload Video (Google Drive) — OAuth2 (Google). Uploads the downloaded video file to a specified Google Drive folder (named with timestamp + original filename). Update result (Google Sheets) — OAuth2 (Google). Updates the original Google Sheet row with the video URL from Veo3 in the "VIDEO" column. HTTP Request (Upload to YouTube) — Header Auth (Authorization: Apikey YOURAPIKEY). Uploads the video to YouTube via the Upload-Post API. Sends multipart form data including the title (from GPT-4o), username, platform (youtube), and the video binary. Update Youtube URL (Google Sheets) — OAuth2 (Google). Updates the same Google Sheet row with the YouTube video URL in the "YOUTUBE_URL" column. Upload on TikTok (HTTP Request) — Header Auth (same as Upload-Post). Uploads the same video to TikTok via the Upload-Post API, using the same title and username but with platform set to "tiktok". Setup Instructions Google Services: You need a Google Cloud project with the Sheets API and Drive API enabled. Create OAuth2 credentials and connect them in n8n. Fal.ai Account: Sign up at fal.ai to get an API key. In the HTTP Request nodes (Create Video, Get status, Get Url Video), set Header Auth with Name: and Value: . OpenAI Account: Get an API key from OpenAI. Connect it in the Generate title node. Upload-Post Account: Sign up at Upload-Post (free plan includes 10 uploads/month). Get your API key from Manage API Keys. Set Header Auth with Name: and Value: . Create a profile and use its username in the field. Google Sheet: Create a copy of this template. Add your prompts and durations. Leave the VIDEO and YOUTUBE_URL columns empty. Use Cases & Variations Content Repurposing: Modify the workflow to generate videos from blog posts or articles by adding an HTTP Request node to fetch content first. Multi-Language Support: The GPT-4o prompt already generates titles in the same language as the input. You can extend this to translate prompts before video generation. Additional Platforms: Add more HTTP Request nodes to upload to Instagram, Facebook, or LinkedIn using the same Upload-Post API (just change the parameter). Scheduling: Instead of running every 5 minutes, you could trigger the workflow via webhook from a form submission (e.g., Typeform or Google Forms). Thumbnail Generation: Add a node to generate video thumbnails using DALL-E or another image generation API before uploading. Analytics Tracking: After upload, add nodes to fetch video analytics from YouTube API and log them back to the Google Sheet.