n8n Tutorial: Build a Real-Time Twitter/X Mention Monitor
Tracking brand mentions on Twitter/X manually is a losing battle. By the time you see a comment, the conversation has moved on. n8n lets you wire up a real-time monitor that catches every mention, rou
Tracking brand mentions on Twitter/X manually is a losing battle. By the time you see a comment, the conversation has moved on. n8n lets you wire up a real-time monitor that catches every mention, routes it to Slack or email, and keeps a log — without writing a single line of server code.
What You'll Need Before You Start
This workflow runs entirely inside n8n, but it depends on a few external pieces you need to have ready:
- Twitter/X Developer Account — you need API v2 access with at least Basic tier ($100/month) to use the filtered stream endpoint. Free tier does not support real-time streaming.
- n8n instance — self-hosted on a VPS or cloud, or n8n Cloud. The workflow uses a webhook trigger, so your instance must be publicly reachable.
- Bearer Token — generated from your Twitter Developer Portal app credentials.
- Notification target — Slack channel, email address, or a Google Sheet to log mentions.
Once those are in place, the build takes under 20 minutes.
How the Workflow Is Structured
The architecture is straightforward: a persistent HTTP request polls the Twitter v2 filtered stream, parses each tweet as it arrives, filters out noise, and routes relevant mentions to your chosen destination.
- Node 1 — HTTP Request (Stream): Connects to
https://api.twitter.com/2/tweets/search/streamwith your Bearer Token in the Authorization header. Set the response format to streaming and enable "Split Into Items" so each tweet triggers the next node independently. - Node 2 — Set Rules (one-time setup): Before activating the main flow, use a separate HTTP Request node to POST your filter rules to
/2/tweets/search/stream/rules. Rules use Twitter's operator syntax — for example:@yourbrand OR "your brand" -is:retweet lang:en. This runs once; rules persist on Twitter's side. - Node 3 — IF Node: Filter out retweets, low-follower accounts, or languages you don't care about. A simple expression like
{{ $json.data.text.startsWith("RT") }}drops retweets before they hit your inbox. - Node 4 — Slack or Email: Format a clean message with the tweet text, author, and a direct link. For Slack, use the Slack node with a Block Kit message for readable output. For email, the Gmail or SMTP node works fine.
- Node 5 — Google Sheets (optional): Append every mention to a sheet for weekly review. Columns: timestamp, author handle, follower count, tweet text, URL, sentiment flag.
Common Issues and How to Fix Them
A few things break this workflow in predictable ways. Knowing them upfront saves hours of debugging:
- Stream disconnects silently: Twitter's filtered stream drops idle connections after 20 seconds with no activity. Add a "keep-alive" check — if no tweet arrives in 30 seconds, reconnect automatically using an n8n Error Trigger node pointed back at the HTTP Request node.
- Duplicate mentions: If your n8n instance restarts while the stream is open, you may receive buffered tweets twice. Add a Redis or Google Sheets deduplication step using the tweet ID as a unique key.
- Rate limits on rules API: You can set up to 25 rules on Basic tier. Be specific — broad rules like just your brand name without filters will flood your workflow with noise and eat through any downstream API quotas fast.
- Bearer Token expiry: Twitter Bearer Tokens don't expire, but app-level credential resets will invalidate them. Store the token in n8n's credential vault, not hardcoded in a node.
Extending the Workflow
Once the basic monitor is running, there are several high-value extensions worth adding:
- Sentiment scoring: Pass the tweet text through an AI node (Claude or OpenAI) to tag each mention as positive, neutral, or negative. Route negative mentions to a high-priority Slack channel for immediate response.
- Competitor tracking: Add rules for competitor brand names. Log those mentions separately to spot product feedback and positioning opportunities.
- Auto-reply drafts: For mentions that include a question mark, generate a draft reply using an AI node and send it to a "pending replies" Slack channel for a human to approve before posting.
- Weekly digest: Schedule a separate n8n workflow every Monday morning that reads your Google Sheet log, summarizes mention volume and sentiment trends, and emails it to your team.
If you'd rather skip the build entirely and get a pre-tested version of this workflow — along with 99 other automations for sales, marketing, and operations — check out the ready-made n8n templates available on Gumroad. Each template includes a working workflow JSON, setup instructions, and documented node configurations you can deploy in minutes.
A Twitter/X mention monitor is one of those automations that pays for itself the first time you catch a complaint before it goes viral, or spot a partnership opportunity before a competitor does. The stream API makes it genuinely real-time — not polling every 15 minutes, but processing tweets as they're published. Once it's live, you can stop checking Twitter manually and let the workflow do the watching.