Use this powerful n8n workflow to automatically identify trending topics using AI, generate summaries via OpenAI, post to Twitter, log activities in MySQL, and notify Slack. Boost your content strategy with these n8n templates.
Download this n8n workflow template and start using it instantly.
Content Strategists needing timely social media posts.
Marketing Teams looking for efficient Twitter automation.
Developers seeking advanced n8n templates integrating Langchain AI Agents, databases, and social media APIs.
Users familiar with n8n nodes and MySQL for robust workflow tracking.
Maintaining a relevant and active social media presence requires constant monitoring of trending topics. This comprehensive n8n workflow solves the problem of manual trend identification and content creation by fully automating the process every two hours. It begins with an n8n trigger (Schedule Trigger) that initiates a highly intelligent AI Agent to select the most relevant, brand-safe U.S. trend while suppressing recently published topics via a MySQL database look-up. A second AI Agent then generates a compelling summary using OpenAI's capabilities. The final steps ensure the content is posted to Twitter, logged accurately in the database for compliance and history, and reported instantly via Slack. This advanced n8n template demonstrates powerful orchestration between custom code, advanced AI agents, and critical business systems, providing a fully integrated solution.
This automation is initiated by the Schedule Trigger, a core n8n trigger set to run every two hours.
AI Agent Preprocess n8n node, leveraging an OpenAI Chat Model and a custom tool (MCP Client), analyzes US trends, scores them based on engagement potential, filters against the exclusion list, and selects the single best trend name.Function n8n node (Format Results1) standardizes the AI output for downstream processing, ensuring clean data structure.AI Agent n8n node takes the trend name, searches recent tweets via the MCP Client, and uses the OpenAI model to synthesize a concise, 30–60 word summary explaining why the topic is currently trending. It outputs a structured JSON object containing the trend and summary.keywordformatter Code n8n node processes the AI output, calculates a standardized, canonical form of the trend name, and prepares the full metadata payload.keywordregistry table. It crucially sets a 3-day lockout period for future runs of this n8n workflow.Create Tweet) uses the generated summary and trend name to post the update to the designated X (Twitter) account, completing the cycle of this robust n8n workflow.To deploy this n8n workflow, follow these steps:
Execute a SQL query and Execute a SQL query1 to connect to your database for logging and exclusion checks.OpenAI Chat Model n8n nodes (named 'Cooper Openai' in the JSON). Ensure your key supports the models specified (e.g., gpt-5-mini).HTTP Header Auth credential for the two MCP Client n8n nodes, which are essential for accessing the custom Twitter search tools.Send a message n8n node and verify the #mcp-hub-test channel ID is correct.Create Tweet n8n node to allow posting. Schedule Trigger: This is the initial n8n trigger, configured to run every 2 hours at minute 12.
Execute a SQL query1 (MySQL n8n node): Function is to retrieve recently published trends (within 3 days) to create an exclusion list, preventing content repetition.
AI Agent Preprocess (n8n node): Key Configuration uses WOEID 23424977 (United States) to find trends. It applies filtering rules based on the MySQL exclusion list and scores items for engagement potential.
AI Agent (n8n node): The core content generator. It is configured to call the aigeon-ai-twitter154.searchtweets tool and synthesize a 30-60 word explanation of the trend, outputting a strict JSON payload.
keywordformatter (Code n8n node): A critical n8n node for data sanitization. It calculates the canon (canonical) form of the trend name by normalizing and cleaning the string, ensuring consistent database records.
Execute a SQL query (MySQL n8n node): Logs the published content, status, and sets the nexteligibleat timestamp (3 days from now) using prepared statements to prevent SQL injection.
Send a message (Slack n8n node): Provides immediate operational feedback by sending the generated summary to the designated Slack channel.
Create Tweet (Twitter n8n node): The final action, posting the combination of the trend name and the AI-generated summary.
Automate professional replies on X (Twitter). This n8n workflow uses GPT for smart filtering, generates insightful responses, and rotates topics using a custom n8n node, scaling your social presence.

Automate monitoring for new content on social media platforms like Truth Social. This powerful n8n workflow sends real-time alerts to Telegram and Discord using Supabase for deduplication.

Use this advanced n8n workflow to automate weekly trend research via Apify, generate three unique blog posts using GPT-4o and DALL-E, and save them directly to Notion drafts.

Use this powerful n8n workflow to automate high-quality, character-limited tweets (X posts) using GPT-4, track history in Google Sheets, and prevent duplicate content. Discover more n8n templates.

Automate social media monitoring using this comprehensive n8n workflow. Fetch posts via Apify, analyze sentiment with the OpenAI n8n node, send alerts via Slack, and log results in Google Sheets. Explore powerful n8n templates.








































