自动化专业回复 X(原 Twitter)推文
高级
这是一个Social Media, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Set, Code, Wait, Twitter, ManualTrigger 等节点。 使用GPT和定时轮换自动化X平台推文筛选与回复
前置要求
- •Twitter API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "F1ngpzitCtWY5ox2",
"meta": {
"instanceId": "6bad1eba185697a960de5bc9203d6bff2fd56440a0b5303c382e0b1537a2a568"
},
"name": "自动化专业回复 X(原 Twitter)推文",
"tags": [],
"nodes": [
{
"id": "9638802e-00ea-4682-8a99-f559a9aa901b",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
1560,
960
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f33c9d90-c193-4e07-9631-3a0bcda37d75",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
3520,
740
],
"webhookId": "7f338efb-93c4-47f8-96a2-6cf56b611a9d",
"parameters": {
"unit": "minutes",
"amount": 15
},
"typeVersion": 1.1
},
{
"id": "6be8d0b6-d78c-4c65-8d33-56c54dce6d93",
"name": "等待1",
"type": "n8n-nodes-base.wait",
"position": [
4140,
740
],
"webhookId": "bfe1d434-dc27-4313-9f47-56d21d2b3eb8",
"parameters": {
"unit": "minutes",
"amount": 15
},
"typeVersion": 1.1
},
{
"id": "745cdd54-689c-4736-be3f-b97eb2fde6d8",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
3300,
720
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "8d07ff84-970b-411e-95c4-b49586d80b73",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
1560,
740
],
"parameters": {
"rule": {
"interval": [
{
"daysInterval": 3,
"triggerAtHour": 9
}
]
}
},
"typeVersion": 1.2
},
{
"id": "87b7abc7-5636-4d84-aa51-197e8c14ffb2",
"name": "设置搜索词",
"type": "n8n-nodes-base.set",
"position": [
1800,
740
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f6484cd1-f15d-4ac0-9d61-aa322f1f4c02",
"name": "searchTerms",
"type": "array",
"value": "=[\"AI Engineer\", \"Fullstack developer\", \"As a CEO\", \"JavaScript developer\", \"React developer\", \"Tech recruiter\", \"TypeScript developer\", \"Workflow automation\", \"Automation engineer\", \"n8n\"]"
},
{
"id": "a12d0bf5-5cf4-4d4f-af90-e2ee949e05d0",
"name": "role",
"type": "string",
"value": "Fullstack Developer and AI Engineer"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "28b30e1e-d168-4602-8042-fd01080e7a5f",
"name": "轮换槽位索引生成器",
"type": "n8n-nodes-base.code",
"position": [
2020,
740
],
"parameters": {
"jsCode": "// Set a fixed base date to start counting from (can be any date)\nconst baseDate = new Date(\"2025-01-01\");\n\n// Get today's date\nconst today = new Date();\n\n// Calculate the total number of days passed since the base date\nconst diffInDays = Math.floor((today - baseDate) / (1000 * 60 * 60 * 24));\n\n// Each \"slot\" lasts 3 days. Divide the days passed by 3, then get the current slot index (0 to 9)\nconst index = Math.floor(diffInDays / 3) % 10;\n\n// Return the index in the required format (e.g., for n8n or similar workflow tools)\nreturn [{ json: { index } }];\n}\n\n\n/*\n Example: This script shows how to calculate a daily rotating index based on the number of days since a base date.\n The index will increase by one each day, and cycle from 0 to 9.\n You can use this logic for workflows that need to assign a slot, code, or value that changes every day in a repeating pattern.\n*/\n\n// const baseDate = new Date(\"2025-01-01\"); // Set a fixed base date to start counting from (can be any date)\n// const today = new Date(); // Get today's date\n\n// Calculate the total number of days passed since the base date\n// const diffInDays = Math.floor((today - baseDate) / (1000 * 60 * 60 * 24));\n\n// Each slot lasts 1 day. Get the current index (from 0 to 9), rotating every 10 days\n// const index = diffInDays % 10;\n\n// Return the index in the required format (for example, for n8n or similar workflow tools)\n// return [{ json: { index } }];\n"
},
"typeVersion": 2
},
{
"id": "0601e643-0439-4ab3-9748-a69cb30a1ca2",
"name": "X(原 Twitter)搜索词",
"type": "n8n-nodes-base.twitter",
"position": [
2260,
740
],
"parameters": {
"limit": 10,
"operation": "search",
"searchText": "={{ $('Set search Terms').item.json.searchTerms[$json.index] }}",
"additionalFields": {}
},
"typeVersion": 2,
"alwaysOutputData": false
},
{
"id": "50033bf2-737c-43d6-9d28-ffb2fc33091b",
"name": "GPT 主题选择器",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
2740,
740
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "GPT-4.1"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are an AI assistant helping a {{ $('Set search Terms').item.json.role }} select tweets to engage with professionally.\n\nYou will receive a JSON array of tweets, each with:\n{\n \"id\": \"tweet_id\",\n \"text\": \"tweet content\"\n}\n\nYour job:\n1. Discard tweets that are:\n - not written in English\n - memes, jokes, political content, personal replies, spam, or conspiracy theories\n - about internships or entry-level student programs\n - Discard tweets generated by AI bot Grok\n\n2. Return only the tweets that are relevant to the topic\n{{ $('Set search Terms').item.json.searchTerms[$json.index] }}.\n\n3. Return only the filtered tweets in this exact format. The property name must always be `results`:\n\n```json\n{\n \"results\": [\n {\n \"id\": \"1234567890\",\n \"text\": \"tweet content\"\n }\n ]\n}"
},
{
"content": "={{ JSON.stringify($json[\"tweets\"], null, 2) }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "9RjbvMHnwZg2LraO",
"name": "OpenAi ROD"
}
},
"typeVersion": 1.8
},
{
"id": "4dd2f7f7-edee-4703-9309-94d3c1a8d1c1",
"name": "从 JSON 中提取推文",
"type": "n8n-nodes-base.code",
"position": [
3060,
740
],
"parameters": {
"jsCode": "// Get the array of tweet results from the JSON response\nconst tweets = $json.message.content.results;\n\n// Map through each tweet and return a simplified object with only the id and text\nreturn tweets.map(tweet => {\n return {\n json: {\n id: tweet.id, // The unique identifier of the tweet\n text: tweet.text // The text content of the tweet\n }\n };\n});\n"
},
"typeVersion": 2
},
{
"id": "9069c483-e146-4e67-9204-ea93a31b0631",
"name": "将推文分组到单个数组中",
"type": "n8n-nodes-base.code",
"position": [
2540,
740
],
"parameters": {
"jsCode": "// Create and return a single object containing an array of tweets\nreturn [\n {\n json: {\n // The 'tweets' array will contain objects with 'id' and 'text' for each tweet\n tweets: items.map(item => ({\n id: item.json.id, // The unique identifier of the tweet\n text: item.json.text // The text content of the tweet\n }))\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "8d351836-cf9b-4fca-bc74-1bf2ed99312c",
"name": "GPT 推文回复",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
3840,
740
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "GPT-4.1"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are an expert {{ $('Set search Terms').item.json.role }} and friendly Twitter user. You write short, professional replies to tweets that encourage conversation and add value.\n\nAlways reply in the same language as the original tweet.\nBe thoughtful, professional, and insightful. Keep your tone direct and to the point — avoid phrases like \"by the way\" or unnecessary fluff.\n\nYour reply must be no longer than 280 characters.\nOnly return the reply text — no formatting, no explanation, no prefixes.\n\nDo not include links unless those exact conditions are met.\n\nDo not use repetitive or natural phrases or words like \"curious\" or \"I’d love to hear\"\n\nDo not use dashes or hyphens\n"
},
{
"content": "=Tweet: {{ $('Extract Tweets from JSON').item.json.text }}\nWrite a reply that could spark a professional conversation or catch the author’s attention in a natural way."
}
]
}
},
"credentials": {
"openAiApi": {
"id": "9RjbvMHnwZg2LraO",
"name": "OpenAi ROD"
}
},
"typeVersion": 1.8
},
{
"id": "b8579485-bf04-4b3e-8481-d2dc410c8841",
"name": "X(原 Twitter)点赞推文",
"type": "n8n-nodes-base.twitter",
"onError": "continueRegularOutput",
"position": [
3680,
740
],
"parameters": {
"tweetId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Extract Tweets from JSON').item.json.id }}"
},
"operation": "like"
},
"typeVersion": 2
},
{
"id": "13121377-4750-4a3f-88e5-c4478fecdf59",
"name": "X(原 Twitter)发布回复",
"type": "n8n-nodes-base.twitter",
"position": [
4280,
740
],
"parameters": {
"text": "={{ $('GPT Tweet Response').item.json.message.content }}",
"additionalFields": {
"inReplyToStatusId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Extract Tweets from JSON').item.json.id }}"
}
}
},
"typeVersion": 2
},
{
"id": "c7be5433-e176-476b-80f5-e301b306e090",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1520,
0
],
"parameters": {
"width": 640,
"height": 920,
"content": "# 配置您的变量"
},
"typeVersion": 1
},
{
"id": "d3ea38df-42af-440e-a89a-22bb924b8375",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2200,
380
],
"parameters": {
"color": 3,
"width": 480,
"height": 540,
"content": "# X(Twitter)搜索词节点"
},
"typeVersion": 1
},
{
"id": "b500ec65-8e8e-42ff-bf19-1fad94132082",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2700,
240
],
"parameters": {
"color": 4,
"width": 540,
"height": 680,
"content": "# GPT 主题选择器"
},
"typeVersion": 1
},
{
"id": "c63431a7-2426-4d83-8f9b-f98edcab8091",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
3500,
240
],
"parameters": {
"color": 4,
"width": 940,
"height": 680,
"content": "# 循环:点赞、生成和回复推文"
},
"typeVersion": 1
},
{
"id": "5ea891d9-05a1-481d-a6de-8c37dae0b020",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 6,
"width": 1480,
"height": 1220,
"content": "# 专业推文互动自动化"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ccf9c3dd-623b-495d-90f7-5d5a3f3536e8",
"connections": {
"Wait": {
"main": [
[
{
"node": "X (Formerly Twitter) Like Tweet",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "X (Formerly Twitter) Post Reply",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Set search Terms",
"type": "main",
"index": 0
}
]
]
},
"Set search Terms": {
"main": [
[
{
"node": "Rotating Slot Index Generator",
"type": "main",
"index": 0
}
]
]
},
"GPT Topic Selector": {
"main": [
[
{
"node": "Extract Tweets from JSON",
"type": "main",
"index": 0
}
]
]
},
"GPT Tweet Response": {
"main": [
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"Extract Tweets from JSON": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Rotating Slot Index Generator": {
"main": [
[
{
"node": "X (Formerly Twitter) Search terms",
"type": "main",
"index": 0
}
]
]
},
"X (Formerly Twitter) Like Tweet": {
"main": [
[
{
"node": "GPT Tweet Response",
"type": "main",
"index": 0
}
]
]
},
"X (Formerly Twitter) Post Reply": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Group Tweets into a Single Array": {
"main": [
[
{
"node": "GPT Topic Selector",
"type": "main",
"index": 0
}
]
]
},
"X (Formerly Twitter) Search terms": {
"main": [
[
{
"node": "Group Tweets into a Single Array",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Set search Terms",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 社交媒体, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用OpenAI gpt-image-1和AI字幕创建并发布Instagram轮播图
从Google Sheets使用GPT-Image-1和AI字幕自动生成Instagram轮播图
If
Set
Code
+12
32 节点Jorge Martínez
多模态 AI
Twitter品牌自动推广
使用Anthropic Claude AI和Google Sheets报告自动进行Twitter品牌推广
Set
Code
Wait
+10
26 节点Pavlo Hurhu
社交媒体
LinkedIn 自动化
使用 AI 内容生成和 Telegram 审批安排 LinkedIn 帖子
If
Set
Code
+7
18 节点Chad McGreanor
社交媒体
公司邮箱查找器新版本
使用 Serper.dev 和 AnyMailFinder 查找 B2B 决策者邮箱并构建潜在客户数据库
If
Set
Code
+11
33 节点Alexandra Spalato
AI 摘要总结
Arunava的多智能体智能Reddit自动化
使用AI品牌提及和Baserow跟踪自动评论Reddit帖子
If
Set
Code
+12
35 节点Arunava
社交媒体
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
工作流信息
难度等级
高级
节点数量19
分类2
节点类型9
作者
Jorge Martínez
@jorgemartinezjamAI Engineer & Full Stack Developer skilled in designing intelligent agents, workflow automation, and NLP solutions. Experienced with LLMs, Relevance AI, make, zapier, and n8n. Proficient in integrating AI and chatbots into web apps, optimizing processes, and leveraging automation for real-time productivity. Strong background in backend and frontend development, REST APIs, and database management.
外部链接
在 n8n.io 查看 →
分享此工作流