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
- Click the Download button on this page to save the workflow file.
- Open the n8n editor where you want to run the workflow.
- Use Import from File to upload the saved workflow.
Configure the Workflow
- Add Twitter OAuth1 credentials under n8n Settings > Credentials.
- Add RocketChat API credentials for message posting.
- Update any channel names or IDs, such as the RocketChat channel, if different from the default.
- If the workflow uses expressions or code, verify and update them as needed.
Test and Activate
- Run the workflow once manually to confirm it fetches tweets and sends messages.
- If all works, Activate the workflow to let it run automatically.
- 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.
