🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

X + Slack: brand safe trend posts on autopilot

Lisa Granqvist Partner Workflow Automation Expert

Keeping up with X trends sounds simple until you’re doing it daily. You open the trends list, click around, second-guess what’s safe, then lose another 20 minutes trying to write something that doesn’t feel cringe.

Social media managers feel the pressure first. But the same X trend automation headache hits marketing leads who need approvals and founders who just want consistent posting without living on the timeline.

This workflow pulls trending topics, explains why they’re trending, filters for brand safety, prevents repeats, and posts to X while sending your team a clean Slack update. You’ll see what it does, what you need, and how to make it fit your voice.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: X + Slack: brand safe trend posts on autopilot

The Problem: Trends Move Fast, and “On Brand” Moves Slow

Posting about trends is one of those tasks that looks easy from the outside. In practice, it’s a constant loop of checking what’s hot, figuring out what it actually means, deciding if it’s risky, then writing something that doesn’t sound like a bot. And when you’re busy, you default to either skipping trends entirely or posting late, after everyone else already squeezed the juice out of the moment. Add a team into the mix and it gets worse: approvals happen in Slack, drafts happen somewhere else, and the original context is already gone.

The friction compounds. Here’s where it breaks down.

  • Trend research turns into “a quick check” that eats about 30 minutes, then happens again later because you forgot what you saw.
  • You can’t confidently explain why a topic is trending, which means your post lacks context (or you avoid the trend altogether).
  • Brand safety becomes a gut feel, so teams either over-censor and miss opportunities or accidentally wade into a mess.
  • Repeats are common because there’s no memory, so you end up posting the same trend again within a few days.

The Solution: Turn Trends Into Team-Visible, Brand-Safe Posts

This n8n workflow runs on a schedule (every few hours is the usual cadence) and builds a reliable pipeline from “what’s trending” to “what you actually post.” First, it checks your MySQL keyword registry so you don’t recycle the same trends too often. Then it asks an AI agent to select and score US trends, normalizes the list into clean items, and loops through them in batches so you don’t smash API limits. For each trend, another AI step generates a short “why it’s trending” summary (about 30–60 words), applies brand-safety filters, and formats a ready-to-post payload. Your team gets a Slack update with the context, and the workflow waits briefly before publishing to X, with built-in delays to keep things stable.

The workflow starts with a scheduled trigger and a quick database lookup. From there, OpenAI and the twitter154 MCP tools do the heavy lifting: discover trends, analyze the story, and produce commentary that’s meant to be safe to ship. Finally, Slack gets the update and X gets the post, while MySQL records what went out so you don’t repeat it for a few days.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you check trends 3 times a day. Manually, it’s usually 15 minutes to scan, another 10 minutes to figure out why something’s trending, then 10 minutes to draft and share context in Slack, so you’re at about 35 minutes per check (close to 2 hours a day). With this workflow, you spend maybe 5 minutes skimming the Slack update and doing a quick sanity check before it posts. The rest is automated on a schedule, including the “don’t repeat this for 3 days” memory.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Slack for team updates and visibility.
  • X (Twitter) API access to publish the final post.
  • OpenAI API key (get it from the OpenAI dashboard).
  • MySQL database to track posted trends and cooldowns.
  • MCPHub access + twitter154 endpoint to read trends and analyze tweets.

Skill level: Intermediate. You’ll connect a few credentials, add a DB table, and test one manual run before turning on the schedule.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A schedule kicks things off. The workflow runs automatically on a timer, so you can check trends every few hours without someone remembering to do it.

Your “recently posted” memory loads first. It pulls recent keywords from MySQL, which keeps the system from grabbing the same trend again during the cooldown window.

AI selects and explains the trends. A trend selection agent collects US trends through the MCP Trends tool, then another agent summarizes why each trend is taking off and applies filters so you don’t amplify obvious garbage.

Slack gets the context and X gets the post. The workflow formats the payload, sends a team update in Slack, waits briefly, publishes to X, then writes a record back to MySQL and pauses to respect rate limits.

You can easily modify the locale (US vs. other regions) and the cooldown logic based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Schedule Trigger

Set the workflow cadence so the automation runs every two hours at the specified minute.

  1. Add and open Scheduled Run Trigger.
  2. Set the interval to run every 2 hours and Trigger At Minute to 12.
  3. Connect Scheduled Run Trigger to Fetch Recent Keywords.

Step 2: Connect the Keyword Database

Pull the recent published keywords to avoid repeating trends.

  1. Open Fetch Recent Keywords.
  2. Credential Required: Connect your mySql credentials.
  3. Set Operation to executeQuery.
  4. Set Query to the provided SQL that returns exclude.
  5. Set Query Replacement to ={{ [ 'twitter', 'US' ] }}.

Step 3: Set Up Trend Selection AI

Configure the AI selection layer that chooses a single conversation-worthy trend.

  1. Open Trend Selection Agent and keep the prompt text as provided, including {{ JSON.stringify($json.exclude || []) }}.
  2. Attach OpenAI Mini Engine as the language model for Trend Selection Agent.
  3. Credential Required: Connect your openAiApi credentials in OpenAI Mini Engine.
  4. Attach MCP Trends Tool as the tool for Trend Selection Agent.
  5. Credential Required: Connect your httpHeaderAuth credentials in MCP Trends Tool.
  6. Connect Trend Selection Agent to Normalize Trend List.

⚠️ Common Pitfall: The MCP tool credentials must be configured on MCP Trends Tool, not inside Trend Selection Agent.

Step 4: Normalize and Summarize Trends

Split the AI output into individual trend items and summarize each with a second AI agent.

  1. Open Normalize Trend List and keep the Function Code that parses the array and emits { json: { name } }.
  2. Connect Normalize Trend List to Iterate Trend Items.
  3. Open Trend Summary Agent and keep the prompt content, including {{ $json.name }} and {{ encodeURIComponent($json.name) }}.
  4. Attach OpenAI Chat Engine as the language model for Trend Summary Agent.
  5. Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine.
  6. Attach MCP Twitter Tool as the tool for Trend Summary Agent.
  7. Credential Required: Connect your httpHeaderAuth credentials in MCP Twitter Tool.

Trend Summary Agent outputs to both Post Slack Update and Format Trend Payload in parallel.

⚠️ Common Pitfall: If Trend Summary Agent returns non-JSON output, Format Trend Payload will fail to parse it. Ensure the prompt remains strict.

Step 5: Configure Slack, Formatting, and Database Recording

Send the summary to Slack and store the publish payload in MySQL.

  1. Open Post Slack Update and set Text to ={{ $json.output }}.
  2. Credential Required: Connect your slackOAuth2Api credentials in Post Slack Update.
  3. Open Format Trend Payload and keep the JS Code that sets platform to twitter and locale to US, and builds canon.
  4. Format Trend Payload outputs to both Hold for Tweet and Record Publish SQL in parallel.
  5. Open Record Publish SQL and set Operation to executeQuery.
  6. Set Query Replacement to ={{ [ $json.platform || 'twitter', $json.locale || 'US', $json.trend, ($json.canon ?? String($json.trend || '').normalize('NFKC').toLowerCase().replace(/^#+/, '').replace(/\s+/g, ' ').trim() ), $json.summary, $json.search_url, $json.aspect_ratio || '16:9', ($json.channel ?? $json.message?.channel), ($json.message?.ts ?? $json.ts ?? null), ($json.message_timestamp ?? null) ] }}.
  7. Credential Required: Connect your mySql credentials in Record Publish SQL.

⚠️ Common Pitfall: The Slack channel must be set in Post Slack Update or the database insert may store null channel fields.

Step 6: Configure Tweet Publishing and Wait Gates

Publish the tweet after the hold gate and finalize the run using wait nodes.

  1. Open Publish Tweet Post and set Text to ={{ $json.trend }}: {{ $json.summary }}.
  2. Credential Required: Connect your twitterOAuth2Api credentials in Publish Tweet Post.
  3. Confirm the flow Hold for TweetPublish Tweet PostDelay Gate.
  4. Confirm the parallel flow Post Slack UpdateDelay Gate and Record Publish SQLDelay Gate.

Step 7: Test and Activate Your Workflow

Run a manual test to confirm trend selection, Slack posting, database inserts, and tweet publishing.

  1. Click Execute Workflow to run the flow from Scheduled Run Trigger.
  2. Verify Fetch Recent Keywords returns an exclude array and Trend Selection Agent emits a JSON array.
  3. Confirm Trend Summary Agent produces a JSON object with trend, summary, and search_url.
  4. Check that Post Slack Update sends a message and Record Publish SQL writes a row to keyword_registry.
  5. Confirm Publish Tweet Post posts a tweet and both branches reach Delay Gate.
  6. Activate the workflow using the Active toggle for scheduled production runs.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Slack credentials can expire or need specific permissions. If things break, check the n8n Credentials screen and your Slack app scopes first.
  • If you’re using Wait nodes or external processing, timing varies. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this X trend automation automation?

About 10 minutes if you already have the credentials ready.

Do I need coding skills to automate X trend automation?

No. You’ll mostly paste API keys, connect accounts, and tweak prompts.

Is n8n free to use for this X trend automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API usage and your X API plan.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this X trend automation workflow for posting to LinkedIn too?

Yes, but you’ll want separate formatting. You can reuse the Trend Summary Agent output and swap the posting step by adding or replacing the Publish Tweet Post node with a LinkedIn post node, then adjust the Format Trend Payload code to match LinkedIn’s tone and length. Common customizations include changing the locale (WOEID), tightening the brand-safety rules, and extending the MySQL cooldown from 3 days to a week.

Why is my X connection failing in this workflow?

Usually it’s credentials or permissions on your X developer app. Re-check the API access level for posting, confirm the tokens in n8n are current, and look at the node error output for rate-limit messages. If you’re routing calls through the twitter154 MCP server, also verify the MCP endpoint and header auth are correct, since a bad header can look like an X outage.

How many trend items can this X trend automation automation handle?

Practically, dozens per scheduled run is fine. n8n Cloud limits depend on your plan’s monthly executions, and self-hosting depends on your server. This workflow processes trends in batches and includes wait/delay gates, so it’s designed for steady throughput, not blasting hundreds of posts at once.

Is this X trend automation automation better than using Zapier or Make?

For trend discovery plus AI analysis plus cooldown logic, n8n is usually a better fit. You get richer branching, easier “memory” with MySQL, and more control over pacing (those Wait nodes matter when APIs get picky). Zapier and Make can do pieces of this, but once you add duplicate prevention, safety filters, and a loop over multiple trends, costs and complexity creep in. If you’re only trying to send yourself one trend a day in Slack, simpler tools can be fine. Talk to an automation expert if you want help choosing.

Once this is running, trend posting stops being a daily scramble. The workflow handles the repetitive checks and the team context, so you can focus on the few posts that actually deserve a human touch.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal