X + Slack: brand safe trend posts on autopilot
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
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:code-braces", form: "rounded", label: "Format Results1", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items", pos: "b", h: 48 }
n2@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n3@{ icon: "mdi:wrench", form: "rounded", label: "MCP Client", pos: "b", h: 48 }
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/slack.svg' width='40' height='40' /></div><br/>Send a message"]
n5@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n6@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n7@{ icon: "mdi:robot", form: "rounded", label: "AI Agent Preprocess", pos: "b", h: 48 }
n8@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model1", pos: "b", h: 48 }
n9@{ icon: "mdi:wrench", form: "rounded", label: "MCP Client1", pos: "b", h: 48 }
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>Execute a SQL query"]
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>Execute a SQL query1"]
n12@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n13@{ icon: "mdi:cog", form: "rounded", label: "Wait1", pos: "b", h: 48 }
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/x.dark.svg' width='40' height='40' /></div><br/>Create Tweet"]
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>keyword_formatter"]
n13 --> n14
n2 --> n4
n2 --> n15
n3 -.-> n2
n9 -.-> n7
n14 --> n5
n4 --> n5
n0 --> n1
n1 --> n2
n12 --> n11
n6 -.-> n2
n15 --> n13
n15 --> n10
n8 -.-> n7
n7 --> n0
n10 --> n5
n11 --> n7
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n12 trigger
class n2,n7 ai
class n6,n8 aiModel
class n3,n9 ai
class n10,n11 database
class n0,n15 code
classDef customIcon fill:none,stroke:none
class n4,n10,n11,n14,n15 customIcon
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
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
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.
- Add and open Scheduled Run Trigger.
- Set the interval to run every 2 hours and Trigger At Minute to
12. - Connect Scheduled Run Trigger to Fetch Recent Keywords.
Step 2: Connect the Keyword Database
Pull the recent published keywords to avoid repeating trends.
- Open Fetch Recent Keywords.
- Credential Required: Connect your mySql credentials.
- Set Operation to
executeQuery. - Set Query to the provided SQL that returns
exclude. - 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.
- Open Trend Selection Agent and keep the prompt text as provided, including
{{ JSON.stringify($json.exclude || []) }}. - Attach OpenAI Mini Engine as the language model for Trend Selection Agent.
- Credential Required: Connect your openAiApi credentials in OpenAI Mini Engine.
- Attach MCP Trends Tool as the tool for Trend Selection Agent.
- Credential Required: Connect your httpHeaderAuth credentials in MCP Trends Tool.
- 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.
- Open Normalize Trend List and keep the Function Code that parses the array and emits
{ json: { name } }. - Connect Normalize Trend List to Iterate Trend Items.
- Open Trend Summary Agent and keep the prompt content, including
{{ $json.name }}and{{ encodeURIComponent($json.name) }}. - Attach OpenAI Chat Engine as the language model for Trend Summary Agent.
- Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine.
- Attach MCP Twitter Tool as the tool for Trend Summary Agent.
- 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.
- Open Post Slack Update and set Text to
={{ $json.output }}. - Credential Required: Connect your slackOAuth2Api credentials in Post Slack Update.
- Open Format Trend Payload and keep the JS Code that sets
platformtotwitterandlocaletoUS, and buildscanon. - Format Trend Payload outputs to both Hold for Tweet and Record Publish SQL in parallel.
- Open Record Publish SQL and set Operation to
executeQuery. - 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) ] }}. - 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.
- Open Publish Tweet Post and set Text to
={{ $json.trend }}: {{ $json.summary }}. - Credential Required: Connect your twitterOAuth2Api credentials in Publish Tweet Post.
- Confirm the flow Hold for Tweet → Publish Tweet Post → Delay Gate.
- Confirm the parallel flow Post Slack Update → Delay Gate and Record Publish SQL → Delay Gate.
Step 7: Test and Activate Your Workflow
Run a manual test to confirm trend selection, Slack posting, database inserts, and tweet publishing.
- Click Execute Workflow to run the flow from Scheduled Run Trigger.
- Verify Fetch Recent Keywords returns an
excludearray and Trend Selection Agent emits a JSON array. - Confirm Trend Summary Agent produces a JSON object with
trend,summary, andsearch_url. - Check that Post Slack Update sends a message and Record Publish SQL writes a row to
keyword_registry. - Confirm Publish Tweet Post posts a tweet and both branches reach Delay Gate.
- Activate the workflow using the Active toggle for scheduled production runs.
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
About 10 minutes if you already have the credentials ready.
No. You’ll mostly paste API keys, connect accounts, and tweak prompts.
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.
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.
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.
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.
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.
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.