Automate Twitter Mention Alerts with n8n & RocketChat

Struggling to keep up with every @mention on Twitter? This n8n workflow automatically tracks new mentions of @n8n_io and instantly sends alerts to your RocketChat channel, saving you precious monitoring time and ensuring no conversation slips past unnoticed.
twitter
rocketchat
cron
+3
Workflow Identifier: 1479
NODES in Use: Manual Trigger, Set, Function, Twitter, RocketChat, Cron
Automate Twitter mentions with n8n and RocketChat

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

1. The Real Challenge: Keeping Track of Twitter Mentions for Jane

This workflow checks Twitter every minute for new mentions of @n8n_io. It finds new tweets mentioning the handle, filters out duplicates, and sends alerts to a RocketChat channel. This way, the team stays updated in real time without manual tracking.

It helps avoid missed tweets, late responses, and saves about 2 hours daily of manual work.


2. What This Automation Does for Jane

This workflow runs every minute to search for fresh Twitter mentions of @n8n_io.

It collects tweet text, tweet ID, and builds the tweet URL.

It keeps a saved list of old tweet IDs, so only brand new mentions trigger alerts.

Alerts are formatted nicely and sent right to a RocketChat channel.

The result is instant team notification, faster replies, and no missed tweets.


3. Prerequisites ⚙️

  • Twitter account with developer access: the OAuth1 API Key is needed to search Twitter mentions.
  • RocketChat workspace and API credentials: needed to post messages automatically.
  • n8n account: use cloud or self-host n8n to run the workflow.
  • Optional hosting provider like Hostinger to control your n8n instance.

4. Beginner Step-by-step: How to Use This Workflow in n8n Production

Download and Import Workflow

  1. Click the Download button on this page to save the workflow file.
  2. Open the n8n editor where you want to run the workflow.
  3. Use Import from File to upload the saved workflow.

Configure the Workflow

  1. Add Twitter OAuth1 credentials under n8n Settings > Credentials.
  2. Add RocketChat API credentials for message posting.
  3. Update any channel names or IDs, such as the RocketChat channel, if different from the default.
  4. If the workflow uses expressions or code, verify and update them as needed.

Test and Activate

  1. Run the workflow once manually to confirm it fetches tweets and sends messages.
  2. If all works, Activate the workflow to let it run automatically.
  3. Monitor activity and check RocketChat for new alerts.

5. Workflow Inputs, Processing, and Outputs

Inputs

  • Twitter API returns recent tweets that mention @n8n_io.
  • Cron trigger runs every 1 minute to start the workflow.

Processing Steps

  • The workflow extracts Tweet text, Tweet ID, and builds Tweet URL.
  • A Function node compares current Tweet IDs to stored ones to find new tweets only.
  • New mentions are formatted and prepared for sending.

Outputs

  • Formatted messages are posted automatically to the defined RocketChat channel.
  • The team receives alerts instantly to respond.

6. Edge Cases and Common Failures

  • If Twitter API credentials are wrong, the workflow fails with 401 errors.
  • If RocketChat channel name is wrong or API token is revoked, messages do not appear.
  • Clearing the static data causes duplicate tweet alerts.
  • Missing to activate the workflow or nodes will stop automation.

7. Customization Ideas ✏️

  • Change the Twitter handle in the Twitter node to watch other accounts.
  • Adjust Cron timing for less frequent tweet checks, like every 5 or 10 minutes.
  • Send alerts to different RocketChat channels for different teams.
  • Add more tweet details such as username, follower count, or tweet creation time.

8. Deployment Guide

After testing, activate the workflow in n8n.

Cron runs every minute checking Twitter automatically.

Watch logs for errors or performance issues.

Change Cron frequency based on team needs.

Use error alerting if this workflow is critical.


9. Conclusion

This workflow helps save time by automating Twitter mention alerts.

It lets teams respond faster and keep track easily.

It works inside n8n with simple setup and real-time updates.

Consider adding automated replies or analytics next.

With this setup, managing Twitter mentions becomes easier for any team.


10. Code Snippet for Filtering New Tweets

The Function node below compares fetched tweet IDs with stored IDs to keep only new tweets for alerts.

const staticData = getWorkflowStaticData('global');
const newTweetIds = items.map(item => item.json["Tweet ID"]);
const oldTweetIds = staticData.oldTweetIds;

if (!oldTweetIds) {
  staticData.oldTweetIds = newTweetIds;
  return items;
}

const actualNewTweetIds = newTweetIds.filter((id) => !oldTweetIds.includes(id));
const actualNewTweets = items.filter((data) => actualNewTweetIds.includes(data.json['Tweet ID']));
staticData.oldTweetIds = [...actualNewTweetIds, ...oldTweetIds];

return actualNewTweets;

This code keeps track of seen tweet IDs so duplicates do not trigger alerts again.


Automate Twitter mentions with n8n and RocketChat

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Re-create or refresh Twitter OAuth1 API credentials in the n8n Credentials settings. Test the connection before use.
The RocketChat channel name may be incorrect or the API token is revoked. Verify channel naming and update API credentials.
Clearing workflow static data or modifying the Function node code incorrectly can cause duplicate alerts. Keep the static data intact.
Yes, by duplicating the workflow or modifying the Twitter node to accept a list and using a SplitInBatches node to loop.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.