Twitter Mentions to Rocket.Chat Notifier
Automate real-time Twitter mention tracking. This workflow fetches new mentions of a specific handle, filters them to avoid duplicates, and sends instant notifications to a Rocket.Chat channel.
Overview
Automatically sends new Twitter mentions of your brand to a Rocket.Chat channel for real-time social media monitoring and team collaboration.
🧠 Description & Use Case
This workflow automates the process of monitoring Twitter for brand mentions and instantly notifying a team via Rocket.Chat. It ensures that every new mention of a specific Twitter handle is captured and delivered as a real-time alert, preventing duplicate notifications for the same tweet.
🔄 How It Works:
-
Scheduled Trigger:
- The
Cronnode initiates the workflow automatically every minute, ensuring continuous monitoring without manual intervention.
- The
-
Fetch Twitter Mentions:
- The
n8n.io mentions(Twitter) node searches Twitter for recent tweets that mention the handle@n8n_io.
- The
-
Extract Key Information:
- The
Filter Tweet Data(Set) node receives the raw tweet data and simplifies it. It extracts only the essential information: the tweet's text, its unique ID, and a direct URL to the tweet.
- The
-
Filter for New Tweets:
- The
Only get new tweets(Function) node is a crucial deduplication step. It maintains a memory of tweet IDs that have already been processed. It compares incoming tweets against this list and only allows new, unseen tweets to pass through, preventing the same mention from being sent multiple times.
- The
-
Send Rocket.Chat Alert:
- For each new mention that passes the filter, the
RocketChatnode formats a message containing the tweet's content and a direct link. It then posts this alert to the 'general' channel in Rocket.Chat, notifying the team instantly.
- For each new mention that passes the filter, the
✅ Real-World Use Cases:
- Social Media Monitoring: Keep a finger on the pulse of your brand's presence on Twitter.
- Customer Support: Quickly identify and respond to customer questions or issues raised on Twitter, improving response times.
- Brand Management: Track brand sentiment and public perception by seeing what users are saying in real-time.
- Internal Communication: Ensure your marketing or communications team is immediately aware of online conversations involving your brand.
Instructions
Basic steps
- Download workflow JSON
- Import into n8n
- Configure node parameters as needed
- Test and enable the workflow
💡 Tips
After importing, verify all connectors and credentials match your environment.
Preview
Workflow Visualization
Nodes
On clicking 'execute'
manualTrigger
Filter Tweet Data
set
Only get new tweets
function
n8n.io mentions
RocketChat
rocketchat
Cron
cron
Statistics
View full JSON structure
{
"nodes": [
{
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"disabled": true,
"position": [
400,
850
],
"parameters": {},
"typeVersion": 1
},
{
"name": "Filter Tweet Data",
"type": "n8n-nodes-base.set",
"position": [
680,
300
],
"parameters": {
"values": {
"string": [
{
"name": "Tweet",
"value": "={{$node[\"n8n.io mentions\"].json[\"text\"]}}"
},
{
"name": "Tweet ID",
"value": "={{$node[\"n8n.io mentions\"].json[\"id\"]}}"
},
{
"name": "Tweet URL",
"value": "=https://twitter.com/{{$node[\"n8n.io mentions\"].json[\"user\"][\"screen_name\"]}}/status/{{$node[\"n8n.io mentions\"].json[\"id_str\"]}}"
}
]
},
"options": {},
"keepOnlySet": true
},
"typeVersion": 1
},
{
"name": "Only get new tweets",
"type": "n8n-nodes-base.function",
"position": [
910,
300
],
"parameters": {
"functionCode": "const staticData = getWorkflowStaticData('global');\nconst newTweetIds = items.map(item => item.json[\"Tweet ID\"]);\nconst oldTweetIds = staticData.oldTweetIds; \n\nif (!oldTweetIds) {\n staticData.oldTweetIds = newTweetIds;\n return items;\n}\n\n\nconst actualNewTweetIds = newTweetIds.filter((id) => !oldTweetIds.includes(id));\nconst actualNewTweets = items.filter((data) => actualNewTweetIds.includes(data.json['Tweet ID']));\nstaticData.oldTweetIds = [...actualNewTweetIds, ...oldTweetIds];\n\nreturn actualNewTweets;\n"
},
"typeVersion": 1
},
{
"name": "n8n.io mentions",
"type": "n8n-nodes-base.twitter",
"position": [
480,
300
],
"parameters": {
"operation": "search",
"searchText": "@n8n_io",
"additionalFields": {}
},
"credentials": {
"twitterOAuth1Api": "Twitter Credentials"
},
"typeVersion": 1
},
{
"name": "RocketChat",
"type": "n8n-nodes-base.rocketchat",
"position": [
1150,
300
],
"parameters": {
"text": "=New Mention!: {{$node[\"Filter Tweet Data\"].json[\"Tweet\"]}}.\nSee it here: {{$node[\"Only get new tweets\"].json[\"Tweet URL\"]}}",
"channel": "general",
"options": {},
"jsonParameters": true
},
"credentials": {
"rocketchatApi": "Rocket Chat API"
},
"typeVersion": 1
},
{
"name": "Cron",
"type": "n8n-nodes-base.cron",
"position": [
270,
300
],
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyX",
"unit": "minutes",
"value": 1
}
]
}
},
"typeVersion": 1
}
],
"connections": {
"Cron": {
"main": [
[
{
"node": "n8n.io mentions",
"type": "main",
"index": 0
}
]
]
},
"n8n.io mentions": {
"main": [
[
{
"node": "Filter Tweet Data",
"type": "main",
"index": 0
}
]
]
},
"Filter Tweet Data": {
"main": [
[
{
"node": "Only get new tweets",
"type": "main",
"index": 0
}
]
]
},
"Only get new tweets": {
"main": [
[
{
"node": "RocketChat",
"type": "main",
"index": 0
}
]
]
},
"On clicking 'execute'": {
"main": [
[]
]
}
}
}Actions
Technical Specs
Compatibility
License
This workflow template follows MIT license, you can freely use, modify and distribute.
Please comply with relevant third-party service terms when using.