社交媒体监控
高级
这是一个Market Research, AI Summarization领域的自动化工作流,包含 42 个节点。主要使用 Code, Merge, DataTable, GmailTool, HttpRequest 等节点。 使用AnySite API和GPT的跨平台品牌监控与分析
前置要求
- •Google 账号和 Gmail API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (42)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "gauteMKS8RC8zIGb",
"meta": {
"instanceId": "9bce59fa408e249dab636faffc5a13e5aa1a2e4af3383a551051e8bd22b2a1b9",
"templateCredsSetupCompleted": true
},
"name": "社交媒体监控",
"tags": [],
"nodes": [
{
"id": "7167c958-e821-4082-a13e-eda76c27c0be",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1840,
432
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c26d107c-d1b4-40ae-b983-a66a7b9f81c8",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
864,
448
],
"parameters": {
"numberInputs": 4
},
"typeVersion": 3.2
},
{
"id": "e83df4cd-aaa2-4536-be7e-350aa0414f0e",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1232,
768
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "DzKhX3E7SSLddnv4",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "3009f7cc-fee2-48d4-b886-a81aaaad393e",
"name": "AnySite 获取 Reddit 帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
48,
112
],
"parameters": {
"url": "https://api.anysite.io/api/reddit/posts",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "timeout",
"value": "300"
},
{
"name": "post_url",
"value": "={{ $json.url }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.3
},
{
"id": "7d5e9846-8979-48d8-8e2f-7e1bfc752297",
"name": "AnySite 搜索 Reddit 帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1200,
160
],
"parameters": {
"url": "https://api.anysite.io/api/reddit/search/posts",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "timeout",
"value": "300"
},
{
"name": "query",
"value": "={{ $json.word }}"
},
{
"name": "sort",
"value": "relevance"
},
{
"name": "count",
"value": "2"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"typeVersion": 4.3
},
{
"id": "c00051fb-d3a3-4100-8c1f-4c60c06cf130",
"name": "AnySite 获取 Reddit 帖子评论",
"type": "n8n-nodes-base.httpRequest",
"position": [
48,
304
],
"parameters": {
"url": "https://api.anysite.io/api/reddit/posts/comments",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "timeout",
"value": "300"
},
{
"name": "post_url",
"value": "={{ $json.url }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"typeVersion": 4.3
},
{
"id": "a422b95c-2f44-4652-b420-46a15a3f3d86",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1328,
480
],
"parameters": {
"text": "=Список post_id: {{ $json.post_ids_str }}",
"options": {
"systemMessage": "=\n\nYou are a social media intelligence analyst inside an n8n workflow. Your job: given post_ids and/or pre-fetched posts plus user-defined keywords, you must retrieve records for each post_id from the internal database if needed, normalize and analyze them, generate a concise yet exhaustive report, and send that report by email using the provided email tool. Do not browse the web. Do not invent data.\n\nTools\n\nYou will be provided one or more tools. Prefer these canonical names if available; otherwise use whichever exact email tool is exposed to you in this runtime:\n\t•\tsend_email\n\n\t•\tfetch_posts_by_ids \nReturns an array of Post objects.\n\nIf a tool is unavailable, skip it and proceed with what you have; record any missing post_ids in missing_ids.\n\nInput (user message JSON)\n\n{\n \"post_ids\": [\"...\"], // required if \"posts\" is absent\n \"keywords\": [\"rocket\",\"anysite\"], // required (one or more)\n \"time_range\": {\"from\":\"ISO\",\"to\":\"ISO\"}, // optional\n \"language\": \"en\", // report language; default \"en\"\n \"time_zone\": \"Europe/Amsterdam\", // default \"Europe/Amsterdam\"\n \"email_to\": \"user@example.com\", // required to send the email\n \"context\": {\"brand\":\"...\",\"campaign\":\"...\",\"notes\":\"...\"}, // optional\n \"posts\": [ { ... } ] // optional: full post objects already provided\n}\n\nData handling\n\t•\tIf posts present → use directly.\n\t•\tIf only post_ids → call fetch_posts_by_ids. Record any misses in missing_ids.\n\t•\tAnalyze only provided/returned data. No external calls.\n\nExpected post fields (may vary)\n\ntype, title, text, url, created_at (Unix or ISO), comment_count, vote_count/like_count/repost_count, platform-specific (subreddit_*, comments (array or JSON string), post_id, word, etc.).\n\nNormalization\n\t1.\tConvert created_at to ISO8601 localized to time_zone (default Europe/Amsterdam).\n\t2.\tParse comments if JSON string → array.\n\t3.\tDeduplicate by post_id or url.\n\t4.\tInfer platform from type.\n\t5.\tDetect post language; if different from report language, include a brief 1–2 line translation.\n\t6.\tMap each post to matched keyword(s): from word and actual matches in title/text.\n\t7.\tDisambiguate keyword senses with confidence:\n\t•\trocket → space/launch, brands (e.g., Rocket Mortgage), games/memes, autos (e.g., BRABUS Rocket), food (arugula), fashion/other.\n\t•\tanysite → product/brand vs generic phrase “any site”.\n\nPer-post analytics\n\nFor every post compute:\n\t•\tengagement_proxy: sum of available counters (comment_count + vote_count/like_count/repost_count). If parsed comments array exists, you may add its length. Missing counters → 0.\n\t•\trecency_hours: hours since created_at to now.\n\t•\tkeyword_match_strength: \"strong\" (title/exact), \"medium\" (body), \"weak\" (comments/tags), \"meta\" (only via word).\n\t•\tsentiment: positive / neutral / negative + 1-sentence rationale.\n\t•\tentities: notable brands/people/products/places if inferable.\n\t•\trisks: toxicity, misinformation/rumors, controversy, compliance issues.\n\t•\tdrivers: short notes on what likely drove engagement (e.g., striking media, controversy, timing, celebrity/brand mention).\n\t•\tconfidence: high / medium / low based on data completeness, clarity, and sense disambiguation.\n\nAggregations (deeper detail)\n\t•\tTotals: count of posts; split by platform.\n\t•\tBy keyword: count and share (% of total), plus average engagement_proxy and sentiment mix per keyword.\n\t•\tSenses distribution per keyword (counts, shares, example posts).\n\t•\tPlatform breakdown: per platform totals, median and 75th-percentile engagement (approximate via sorted ranks), top topics.\n\t•\tTrend narrative over time_range: textual description of spikes/dips (hourly/daily as appropriate).\n\t•\tTopic clusters/themes: derive 3–7 themes using simple keyword co-occurrence (e.g., {“space/test/launch”}, {“auto/brabus/edition”}, {“security/telemetry/ads”}); list 1–2 representative posts per theme.\n\t•\tInfluential accounts/authors: where author info is available, rank by contribution to engagement.\n\t•\tRisks & watchouts: consolidated list across posts with brief why-it-matters.\n\t•\tRecommended actions: prioritized, actionable next steps (max per limits.max_actions), with impact/effort tags.\n\t•\tConfidence & data quality: summarize coverage, missing counters, inferred senses.\n\nReport composition (rich)\n\t•\tSubject: Social Media Report • {YYYY-MM-DD} • {keywords} • {posts_count}\n\t•\tHTML body (inline CSS; no external assets). Include these sections in order:\n\t1.\tHeader\n\t•\tTitle, date, time window, time zone, optional context (brand/campaign).\n\t2.\tExecutive summary (5–9 bullets)\n\t•\tKey shifts, top themes, standout posts, immediate risks, recommended next actions (1–3).\n\t3.\tKey metrics (KPI grid + table)\n\t•\tTotals, by-platform split, by-keyword split (counts, shares, avg engagement, sentiment mix).\n\t•\tUse simple CSS bars (e.g., <div style=\"background:#eee\"><div style=\"width:XX%\"></div></div>) to visualize shares.\n\t4.\tKeyword senses\n\t•\tTable of senses per keyword with counts, examples, and confidence notes.\n\t5.\tTrends & themes\n\t•\tShort narrative of volume/engagement over time.\n\t•\t3–7 themes/clusters with 1–2 representative links each.\n\t6.\tTop posts\n\t•\tUp to limits.max_top_posts overall and up to limits.top_posts_per_platform per platform.\n\t•\tFor each: platform, title/summary, link, localized timestamp, engagement_proxy, sentiment, matched keyword(s) & sense, 1–2 brief quotes/comments, drivers, risks (if any).\n\t7.\tPlatform insights\n\t•\tPer-platform highlights: what content resonated, posting times, tone/style patterns.\n\t8.\tRisks & watchouts\n\t•\tBullet list (≤ limits.max_risks) with brief mitigation ideas.\n\t9.\tRecommended actions\n\t•\tPrioritized list with Impact / Effort tags (e.g., High/Low), owner suggestion if inferable from context.\n\t10.\tMethodology & limitations\n\t•\tData source (workflow), missing counters treated as 0, heuristic senses, no external sources, confidence statement.\n\t•\tPlain text: same flow as HTML in clean Markdown/ASCII.\n\nHTML tips (email-safe)\n\t•\tInline CSS only; no external fonts/images/JS.\n\t•\tUse simple tables and <div> bars for shares.\n\t•\tKeep quotes ≤2 lines; truncate long text with ellipsis.\n\nCSV attachments (if supported by tool)\n\nAttach up to four CSVs:\n\t1.\tsummary.csv: keyword,count,share,avg_engagement,positive,neutral,negative\n\t2.\tposts.csv: platform,created_at,url,engagement_proxy,sentiment,keyword,sense,match_strength\n\t3.\ttop_comments.csv: platform,post_url,author,created_at,excerpt\n\t4.\tentities.csv: entity,type,frequency,example_post_url\n\nQuality & constraints\n\t•\tNo fabricated data. Missing counters → 0 (note in methodology).\n\t•\tAbsolute timestamps with time_zone.\n\t•\tKeep paragraphs tight and scannable.\n\t•\tLanguage = language (default \"en\").\n\nError handling\n\t•\tIf email_to missing → do not send; respond with status \"error\" and reason.\n\t•\tIf email tool fails → return \"error\" with the tool’s message.\n\nFinal action — you MUST send the email\n\t1.\tBuild subject, html, text per spec (depth per depth:\n\t•\tstandard: sections 1–3, 6, 10\n\t•\textended (default): all sections except 7 (optional)\n\t•\tmax: include all sections with fuller detail within limits)\n\t2.\tCall the email tool with:\n\t•\tto = email_to\n\t•\tsubject, html, text\n\t•\tattachments if supported\n\t3.\tAfter sending, reply with a single compact JSON acknowledgment (do not echo the full HTML):\n\nReturn exactly one JSON object:\n\n{\n \"status\": \"sent\" | \"error\",\n \"to\": \"string\",\n \"subject\": \"string\",\n \"totals\": {\n \"posts\": 0,\n \"platforms\": {\"reddit\":0,\"x\":0,\"linkedin\":0,\"instagram\":0},\n \"by_keyword\": [{\"keyword\":\"...\",\"count\":0,\"share\":0.0}],\n \"time_window\": {\"from\":\"ISO\",\"to\":\"ISO\",\"time_zone\":\"Europe/Amsterdam\"}\n },\n \"missing_ids\": [\"...\"],\n \"notes\": [\"...\"] // e.g., \"Engagement counters missing on some platforms; treated as 0.\"\n}\n\nPre-send checklist\n\t•\tSubject has date, keywords, post count.\n\t•\tHTML uses inline CSS only.\n\t•\tTotals match analyzed posts.\n\t•\tTime zone consistent.\n\t•\temail_to present and non-empty.\n\n\n⸻\n\nMinimal HTML skeleton you can adapt\n\n<html>\n <body style=\"font-family: Arial, sans-serif; color:#111; line-height:1.5; margin:0; padding:24px;\">\n <h1 style=\"margin:0 0 8px;\">Social Media Report</h1>\n <p style=\"margin:0 0 16px; color:#555;\">Date: {{DATE}} • Window: {{FROM}} — {{TO}} ({{TZ}})</p>\n {{#if CONTEXT}}<p style=\"margin:0 0 16px; color:#555;\">Context: {{CONTEXT}}</p>{{/if}}\n\n <h2 style=\"margin:24px 0 8px;\">Executive summary</h2>\n <ul style=\"margin:0 0 16px; padding-left:20px;\">{{BULLETS}}</ul>\n\n <h2 style=\"margin:24px 0 8px;\">Key metrics</h2>\n <table cellpadding=\"6\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; width:100%; font-size:14px;\">\n <thead><tr><th align=\"left\" style=\"border-bottom:1px solid #ddd;\">Metric</th><th align=\"left\" style=\"border-bottom:1px solid #ddd;\">Value</th></tr></thead>\n <tbody>\n {{KPI_ROWS}}\n </tbody>\n </table>\n\n <h2 style=\"margin:24px 0 8px;\">By keyword</h2>\n {{KEYWORD_ROWS}} <!-- Include share bars like: -->\n <!--\n <div style=\"margin:6px 0;\">\n <strong>rocket</strong> — 65% (13 posts)\n <div style=\"background:#eee; height:8px; width:100%; border-radius:4px;\">\n <div style=\"background:#444; height:8px; width:65%; border-radius:4px;\"></div>\n </div>\n </div>\n -->\n\n <h2 style=\"margin:24px 0 8px;\">Keyword senses</h2>\n {{SENSE_TABLE}}\n\n <h2 style=\"margin:24px 0 8px;\">Trends & themes</h2>\n <p style=\"margin:0 0 8px;\">{{TREND_NARRATIVE}}</p>\n <ul style=\"margin:0 0 16px; padding-left:20px;\">{{THEME_BULLETS}}</ul>\n\n <h2 style=\"margin:24px 0 8px;\">Top posts</h2>\n {{TOP_POST_CARDS}}\n\n <h2 style=\"margin:24px 0 8px;\">Platform insights</h2>\n {{PLATFORM_SECTIONS}}\n\n <h2 style=\"margin:24px 0 8px;\">Risks & watchouts</h2>\n <ul style=\"margin:0 0 16px; padding-left:20px;\">{{RISK_BULLETS}}</ul>\n\n <h2 style=\"margin:24px 0 8px;\">Recommended actions</h2>\n <ol style=\"margin:0 0 16px; padding-left:20px;\">{{ACTION_ITEMS}}</ol>\n\n <h2 style=\"margin:24px 0 8px;\">Methodology & limitations</h2>\n <p style=\"margin:0; color:#555;\">Data analyzed exactly as provided by the workflow (no external sources). Missing counters treated as 0. Keyword senses and themes inferred heuristically. Confidence: {{CONFIDENCE}}.</p>\n </body>\n</html>\n\nRemember: analyze only provided data, send the email yourself via the tool, then return the compact JSON acknowledgment."
},
"promptType": "define"
},
"typeVersion": 3
},
{
"id": "fe4be382-803a-4829-8fcb-9b492861ae3b",
"name": "获取关键词列表",
"type": "n8n-nodes-base.dataTable",
"position": [
-1600,
544
],
"parameters": {
"operation": "get",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "VrIDpq4HXFQBRTU7",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/VrIDpq4HXFQBRTU7",
"cachedResultName": "Brand Monitoring Words"
}
},
"typeVersion": 1
},
{
"id": "e9b7166d-312a-4dd0-8afa-c40e0d13069b",
"name": "AnySite 搜索 LinkedIn 帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1200,
400
],
"parameters": {
"url": "https://api.anysite.io/api/linkedin/search/posts",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "keywords",
"value": "={{ $json.word }}"
},
{
"name": "count",
"value": "2"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"typeVersion": 4.3
},
{
"id": "aa8c0794-6012-40ae-894e-a5972d1db244",
"name": "AnySite 获取 LinkedIn 帖子评论",
"type": "n8n-nodes-base.httpRequest",
"position": [
48,
544
],
"parameters": {
"url": "https://api.anysite.io/api/linkedin/post/comments",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "timeout",
"value": "300"
},
{
"name": "urn",
"value": "=urn:li:activity:{{ $json.post_id }}"
},
{
"name": "sort",
"value": "recent"
},
{
"name": "count",
"value": "30"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.3,
"alwaysOutputData": true
},
{
"id": "64714aa4-379b-43f5-9ce8-625ea769abde",
"name": "AnySite 搜索 Instagram 帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1200,
624
],
"parameters": {
"url": "https://api.anysite.io/api/twitter/search/posts",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "query",
"value": "={{ $json.word }}"
},
{
"name": "count",
"value": "2"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"typeVersion": 4.3
},
{
"id": "cfd2abac-84f3-49cf-8be0-887be12a46a5",
"name": "AnySite 搜索 X 帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1200,
848
],
"parameters": {
"url": "https://api.anysite.io/api/instagram/search/posts",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "timeout",
"value": "300"
},
{
"name": "query",
"value": "={{ $json.word }}"
},
{
"name": "count",
"value": "2"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "access-token"
}
]
}
},
"typeVersion": 4.3
},
{
"id": "67395f5a-9712-4a44-91c2-c38b44d23a28",
"name": "如果 LinkedIn 帖子不存在1",
"type": "n8n-nodes-base.dataTable",
"position": [
-592,
400
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.urn.value }}"
}
]
},
"operation": "rowNotExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "ed0c57df-bc57-40bc-b220-7bfeaeaa8365",
"name": "如果 Reddit 帖子不存在",
"type": "n8n-nodes-base.dataTable",
"position": [
-592,
160
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.id }}"
}
]
},
"operation": "rowNotExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "6b7d65ec-3ac2-4ee5-a5e6-4049952c8d47",
"name": "如果 X 帖子不存在3",
"type": "n8n-nodes-base.dataTable",
"position": [
-592,
848
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.id }}"
}
]
},
"operation": "rowNotExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "85f7b4f1-9191-4397-a296-d45e15c371e2",
"name": "如果 Instagram 帖子不存在2",
"type": "n8n-nodes-base.dataTable",
"position": [
-592,
624
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.id }}"
}
]
},
"operation": "rowNotExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "cfb6bc47-eb96-4f0a-91c4-2916ae51da44",
"name": "插入 Reddit 帖子",
"type": "n8n-nodes-base.dataTable",
"position": [
-368,
160
],
"parameters": {
"columns": {
"value": {
"url": "={{ $json.url }}",
"type": "={{ $json['@type'] }}",
"word": "={{ $('Get word\\'s list').item.json.word }}",
"title": "={{ $json.title }}",
"post_id": "={{ $json.id }}",
"created_at": "={{ $json.created_at }}",
"vote_count": "={{ $json.vote_count }}",
"subreddit_id": "={{ $json.subreddit.id }}",
"comment_count": "={{ $json.comment_count }}",
"subreddit_url": "={{ $json.subreddit.url }}",
"subreddit_alias": "={{ $json.subreddit.alias }}",
"subreddit_description": "={{ $json.subreddit.description }}",
"subreddit_member_count": "={{ $json.subreddit.member_count }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
},
{
"id": "word",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "word",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring"
}
},
"typeVersion": 1
},
{
"id": "161c4a0f-5b7e-463b-8731-8b9f4569562c",
"name": "插入 LinkedIn 帖子",
"type": "n8n-nodes-base.dataTable",
"position": [
-368,
400
],
"parameters": {
"columns": {
"value": {
"url": "={{ $json.url }}",
"text": "={{ $json.text }}",
"type": "={{ $json['@type'] }}",
"word": "={{ $('Get word\\'s list').item.json.word }}",
"post_id": "={{ $json.urn.value }}",
"created_at": "={{ $json.created_at }}",
"vote_count": "={{ $json.reactions[0].count }}",
"comment_count": "={{ $json.comment_count }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
},
{
"id": "word",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "word",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring"
}
},
"typeVersion": 1
},
{
"id": "13d26f5f-7303-4ae7-b6ae-4b3d59952b7a",
"name": "插入 Instagram 帖子",
"type": "n8n-nodes-base.dataTable",
"position": [
-368,
624
],
"parameters": {
"columns": {
"value": {
"url": "={{ $json.url }}",
"text": "={{ $json.text }}",
"type": "={{ $json[\"@type\"] }}",
"word": "={{ $('Get word\\'s list').item.json.word }}",
"post_id": "={{ $json.id }}",
"created_at": "={{ $json.created_at }}",
"vote_count": "={{ $json.retweet_count }}",
"comment_count": "={{ $json.reply_count }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
},
{
"id": "word",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "word",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring"
}
},
"typeVersion": 1
},
{
"id": "c5a56796-dd48-440a-923f-7fd3a4ffc434",
"name": "插入 X 帖子",
"type": "n8n-nodes-base.dataTable",
"position": [
-368,
848
],
"parameters": {
"columns": {
"value": {
"url": "={{ $json.url }}",
"text": "={{ $json.text }}",
"type": "={{ $json[\"@type\"] }}",
"word": "={{ $('Get word\\'s list').item.json.word }}",
"post_id": "={{ $json.id }}",
"created_at": "={{ $json.created_at }}",
"vote_count": "={{ $json.like_count }}",
"comment_count": "={{ $json.comment_count }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
},
{
"id": "word",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "word",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring"
}
},
"typeVersion": 1
},
{
"id": "11713917-d244-4d96-abfc-160f67143a01",
"name": "更新 Reddit 帖子详情",
"type": "n8n-nodes-base.dataTable",
"position": [
256,
32
],
"parameters": {
"columns": {
"value": {
"text": "={{ $json.text }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.id }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "36dfff36-e33d-4d00-a7d8-003fc99825ca",
"name": "将评论转换为字符串",
"type": "n8n-nodes-base.code",
"position": [
256,
224
],
"parameters": {
"jsCode": "const MAX_LEN = 0; \n\nfunction toArrayMaybe(json) {\n if (Array.isArray(json)) return json;\n if (Array.isArray(json?.comments)) return json.comments;\n if (typeof json === 'string') {\n try {\n const parsed = JSON.parse(json);\n if (Array.isArray(parsed)) return parsed;\n if (Array.isArray(parsed?.comments)) return parsed.comments;\n } catch (_) {}\n }\n if (typeof json?.data === 'string') {\n try {\n const parsed = JSON.parse(json.data);\n if (Array.isArray(parsed)) return parsed;\n } catch (_) {}\n }\n return null;\n}\n\nfunction getIncomingComments(items) {\n const looksLikeSingleComment =\n items.length > 1 ||\n (items[0]?.json && items[0].json['@type'] === '@reddit_comment');\n if (looksLikeSingleComment) {\n return items\n .map(i => i.json)\n .filter(v => v && typeof v === 'object');\n }\n const payload = items[0]?.json;\n const arr = toArrayMaybe(payload);\n if (arr) return arr;\n return [];\n}\n\nfunction formatDate(unix) {\n if (!unix && unix !== 0) return null;\n const date = new Date(unix * 1000);\n return date.toLocaleString('ru-RU', {\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', second: '2-digit'\n });\n}\n\nfunction transformComment(comment) {\n if (!comment || comment.is_deleted || !comment.text) return null;\n return {\n author: comment.author?.name || '[deleted]',\n created_at_unix: comment.created_at,\n created_at: formatDate(comment.created_at),\n text: comment.text,\n replies: (comment.replies || [])\n .map(transformComment)\n .filter(Boolean),\n };\n}\n\nfunction stringifySafe(obj) {\n const s = JSON.stringify(obj);\n if (MAX_LEN > 0 && s.length > MAX_LEN) {\n return s.slice(0, MAX_LEN - 3) + '...';\n }\n return s;\n}\n\nconst allComments = getIncomingComments(items);\n\nconst topLevel = allComments.filter(\n c => c && typeof c.parent_id === 'string' && c.parent_id.startsWith('t3_')\n);\n\nconst byPost = {};\nfor (const c of topLevel) {\n const postId = c.parent_id;\n const t = transformComment(c);\n if (!t) continue;\n if (!byPost[postId]) byPost[postId] = [];\n byPost[postId].push(t);\n}\n\nconst out = Object.entries(byPost).map(([post_id, comments]) => {\n return {\n json: {\n post_id,\n comments_count: comments.length,\n comments_json: stringifySafe(comments)\n }\n };\n});\n\nreturn out.length ? out : [{ json: { post_id: null, comments_count: 0, comments_json: '[]' } }];"
},
"typeVersion": 2
},
{
"id": "29671c8b-fd0b-4970-9324-5e43072f1158",
"name": "更新 Reddit 帖子评论",
"type": "n8n-nodes-base.dataTable",
"position": [
448,
224
],
"parameters": {
"columns": {
"value": {
"comments": "={{ $json.comments_json }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.post_id }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "5d0d8f1b-d5f3-47b5-91ef-1a8dc8a2fbad",
"name": "将 LinkedIn 评论转换为字符串",
"type": "n8n-nodes-base.code",
"position": [
256,
496
],
"parameters": {
"jsCode": "const MAX_LEN = 0;\n\nfunction toArrayMaybe(json) {\n if (Array.isArray(json)) return json;\n if (Array.isArray(json?.comments)) return json.comments;\n if (typeof json === 'string') {\n try {\n const parsed = JSON.parse(json);\n if (Array.isArray(parsed)) return parsed;\n if (Array.isArray(parsed?.comments)) return parsed.comments;\n } catch (_) {}\n }\n if (typeof json?.data === 'string') {\n try {\n const parsed = JSON.parse(json.data);\n if (Array.isArray(parsed)) return parsed;\n } catch (_) {}\n }\n return null;\n}\n\nfunction getIncoming(items) {\n const looksLikeFlat =\n items.length > 1 ||\n (items[0]?.json && String(items[0].json['@type'] || '').includes('@linkedin_post_comment'));\n if (looksLikeFlat) {\n return items.map(i => i.json).filter(v => v && typeof v === 'object');\n }\n const payload = items[0]?.json;\n const arr = toArrayMaybe(payload);\n if (arr) return arr;\n return [];\n}\n\nfunction formatDateSmart(ts) {\n if (ts == null) return null;\n const isMs = Math.abs(ts) > 1e12;\n const d = new Date((isMs ? ts : ts * 1000));\n return d.toLocaleString('ru-RU', {\n year: 'numeric', month: '2-digit', day: '2-digit',\n hour: '2-digit', minute: '2-digit', second: '2-digit'\n });\n}\n\nfunction extractPostIdFromUrnValue(val) {\n if (typeof val !== 'string') return null;\n const m = val.match(/(?:activity|ugcPost):(\\d+)/);\n return m ? m[1] : null;\n}\n\nfunction extractPostIdAny(c) {\n let id = extractPostIdFromUrnValue(c?.urn?.value);\n if (id) return id;\n id = extractPostIdFromUrnValue(c?.parent?.value);\n if (id) return id;\n id = extractPostIdFromUrnValue(c?.url);\n if (id) return id;\n try {\n const decoded = decodeURIComponent(c?.url || '');\n id = extractPostIdFromUrnValue(decoded);\n if (id) return id;\n } catch (_) {}\n return null;\n}\n\nfunction stringifySafe(obj) {\n const s = JSON.stringify(obj);\n if (MAX_LEN > 0 && s.length > MAX_LEN) return s.slice(0, MAX_LEN - 3) + '...';\n return s;\n}\n\nfunction transformLinkedInComment(c) {\n if (!c || !c.text) return null;\n const post_id = extractPostIdAny(c) || 'unknown_post';\n const created_at_raw = c.created_at ?? null;\n return {\n post_id,\n author: c.author?.name || '[unknown]',\n author_url: c.author?.url || null,\n text: c.text,\n created_at_raw,\n created_at: formatDateSmart(created_at_raw),\n reactions: Array.isArray(c.reactions) ? c.reactions : null,\n is_commenter_post_author: !!c.is_commenter_post_author,\n replies: [],\n };\n}\n\nconst raw = getIncoming(items);\nconst normalized = raw.map(transformLinkedInComment).filter(Boolean);\n\nconst byPost = {};\nfor (const t of normalized) {\n const key = t.post_id || 'unknown_post';\n if (!byPost[key]) byPost[key] = [];\n byPost[key].push({\n author: t.author,\n author_url: t.author_url,\n text: t.text,\n created_at_raw: t.created_at_raw,\n created_at: t.created_at,\n reactions: t.reactions,\n is_commenter_post_author: t.is_commenter_post_author,\n replies: t.replies,\n });\n}\n\nconst out = Object.entries(byPost).map(([post_id, comments]) => ({\n json: {\n post_id,\n comments_count: comments.length,\n comments_json: stringifySafe(comments)\n }\n}));\n\nreturn out.length ? out : [{ json: { post_id: null, comments_count: 0, comments_json: '[]' } }];"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "f210b1c2-546e-4480-86d5-41d5805e424d",
"name": "更新 LinkedIn 评论",
"type": "n8n-nodes-base.dataTable",
"position": [
448,
496
],
"parameters": {
"columns": {
"value": {
"comments": "={{ $json.comments_json }}"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "title",
"defaultMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "url",
"defaultMatch": false
},
{
"id": "created_at",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "created_at",
"defaultMatch": false
},
{
"id": "subreddit_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_id",
"defaultMatch": false
},
{
"id": "subreddit_alias",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_alias",
"defaultMatch": false
},
{
"id": "subreddit_url",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_url",
"defaultMatch": false
},
{
"id": "subreddit_description",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_description",
"defaultMatch": false
},
{
"id": "comment_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "comment_count",
"defaultMatch": false
},
{
"id": "vote_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "vote_count",
"defaultMatch": false
},
{
"id": "text",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "text",
"defaultMatch": false
},
{
"id": "comments",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "comments",
"defaultMatch": false
},
{
"id": "subreddit_member_count",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "subreddit_member_count",
"defaultMatch": false
},
{
"id": "post_id",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "post_id",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.post_id }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "6435b75f-d22f-491d-b4ac-f5cf04019f32",
"name": "获取所有新帖子的帖子 ID",
"type": "n8n-nodes-base.code",
"position": [
1072,
480
],
"parameters": {
"jsCode": "const FILTER_TYPES = null;\nconst MAX_LEN = 0;\n\nfunction toArrayMaybe(json) {\n if (Array.isArray(json)) return json;\n if (typeof json === 'string') {\n try {\n const parsed = JSON.parse(json);\n if (Array.isArray(parsed)) return parsed;\n } catch (_) {}\n }\n if (Array.isArray(json?.data)) return json.data;\n if (typeof json?.data === 'string') {\n try {\n const parsed = JSON.parse(json.data);\n if (Array.isArray(parsed)) return parsed;\n } catch (_) {}\n }\n return null;\n}\n\nfunction getIncoming(items) {\n if (items.length > 1 && items.every(i => i?.json && typeof i.json === 'object')) {\n return items.map(i => i.json);\n }\n const payload = items[0]?.json;\n const arr = toArrayMaybe(payload);\n if (arr) return arr;\n if (payload && typeof payload === 'object') return [payload];\n return [];\n}\n\nfunction cutIfNeeded(str) {\n if (MAX_LEN > 0 && str.length > MAX_LEN) {\n return str.slice(0, MAX_LEN - 3) + '...';\n }\n return str;\n}\n\nconst posts = getIncoming(items);\n\nconst filtered = Array.isArray(FILTER_TYPES)\n ? posts.filter(p => FILTER_TYPES.includes(p.type))\n : posts;\n\nconst idsUnique = Array.from(\n new Set(\n filtered\n .map(p => String(p.post_id ?? '').trim())\n .filter(v => v.length > 0)\n )\n);\n\nconst post_ids_str = cutIfNeeded(idsUnique.join(','));\n\nreturn [{\n json: {\n total: idsUnique.length,\n post_ids: idsUnique,\n post_ids_str\n }\n}];"
},
"typeVersion": 2
},
{
"id": "9c4d669b-a88b-40cb-a6fc-1da404260ec9",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1840,
640
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 1
}
]
}
},
"typeVersion": 1.2
},
{
"id": "703ab5b6-b4e9-4e85-920d-49daaba5e7a8",
"name": "在 Gmail 中发送消息",
"type": "n8n-nodes-base.gmailTool",
"position": [
1568,
768
],
"webhookId": "879f2106-41e2-4eca-958f-60aa6d960e10",
"parameters": {
"sendTo": "kulikov.andrey.a@gmail.com",
"message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
"options": {},
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
},
"credentials": {
"gmailOAuth2": {
"id": "naiF674gkuvb8Iql",
"name": "Andrew"
}
},
"typeVersion": 2.1
},
{
"id": "378a44d5-100d-49f3-8c00-4057ddab5e48",
"name": "获取帖子信息",
"type": "n8n-nodes-base.dataTableTool",
"position": [
1424,
768
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', `post_id`, 'string') }}"
}
]
},
"operation": "get",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "B9xklN5LC5Yv67oC",
"cachedResultUrl": "/projects/KcvI5ipbOFN8ryQN/datatables/B9xklN5LC5Yv67oC",
"cachedResultName": "Brand Motitoring Posts"
}
},
"typeVersion": 1
},
{
"id": "ccb9423f-734a-456a-a688-a4976bc29bb1",
"name": "概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2496,
-480
],
"parameters": {
"color": 4,
"width": 500,
"height": 1360,
"content": "## 使用 AnySite.io 的社交媒体监控工作流"
},
"typeVersion": 1
},
{
"id": "2b0a2f31-fbe4-4d49-b044-d9aae1be017c",
"name": "AnySite.io 归属",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2496,
944
],
"parameters": {
"color": 5,
"width": 504,
"height": 376,
"content": "## 🚀 使用 AnySite.io 构建"
},
"typeVersion": 1
},
{
"id": "42b7955d-b080-4f22-b1bf-228bb4df1d77",
"name": "自定义指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1984,
-496
],
"parameters": {
"color": 5,
"width": 700,
"height": 340,
"content": "💚 **如何自定义您的监控:**"
},
"typeVersion": 1
},
{
"id": "116079d0-8561-4d28-9785-a577e3128ff3",
"name": "触发器与设置",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1952,
-96
],
"parameters": {
"color": 7,
"width": 680,
"height": 440,
"content": "## 1. 触发器与关键词设置"
},
"typeVersion": 1
},
{
"id": "c4812c10-83fa-455f-94e8-f0767d6e6fde",
"name": "测试指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
1712,
288
],
"parameters": {
"color": 7,
"width": 680,
"height": 476,
"content": "## 🧪 测试您的工作流"
},
"typeVersion": 1
},
{
"id": "c53449ea-7e0f-42fd-b5ef-be1d1365dfb6",
"name": "跨平台搜索",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1248,
-432
],
"parameters": {
"color": 7,
"width": 424,
"height": 536,
"content": "## 2. 跨平台搜索阶段"
},
"typeVersion": 1
},
{
"id": "f6b05865-e713-4be4-8804-084ed7c674bc",
"name": "去重检查",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-432
],
"parameters": {
"color": 7,
"width": 472,
"height": 520,
"content": "## 3. 数据库去重"
},
"typeVersion": 1
},
{
"id": "22c9055f-d2c1-4295-b0d1-81ee4a6fd172",
"name": "数据提取",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
-432
],
"parameters": {
"color": 7,
"width": 504,
"height": 456,
"content": "## 4. 平台特定数据提取"
},
"typeVersion": 1
},
{
"id": "512d331c-3530-4f53-b53a-484cc045909b",
"name": "设置要求 - AI 和 Gmail",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
-528
],
"parameters": {
"color": 3,
"width": 504,
"height": 404,
"content": "## ⚠️ 设置要求 (3/3)"
},
"typeVersion": 1
},
{
"id": "c3acde67-cfe6-48a8-b550-9dcbe47a4c56",
"name": "AI 分析与警报",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-64
],
"parameters": {
"color": 7,
"width": 776,
"height": 424,
"content": "## 5. 智能分析与通知"
},
"typeVersion": 1
},
{
"id": "a8534447-9446-4cc0-b571-d3b3716636c6",
"name": "监控最佳实践",
"type": "n8n-nodes-base.stickyNote",
"position": [
976,
976
],
"parameters": {
"color": 5,
"width": 680,
"height": 320,
"content": "## 📊 监控最佳实践"
},
"typeVersion": 1
},
{
"id": "89ec745b-cdc6-48c7-9fa9-db19b24528d9",
"name": "设置要求 - AnySite",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1248,
-944
],
"parameters": {
"color": 3,
"width": 408,
"height": 468,
"content": "## ⚠️ 设置要求 (1/3)"
},
"typeVersion": 1
},
{
"id": "0c451224-8fed-4d31-a633-e7702b258232",
"name": "设置要求 - 数据库",
"type": "n8n-nodes-base.stickyNote",
"position": [
-656,
-1472
],
"parameters": {
"color": 3,
"width": 440,
"height": 932,
"content": "## ⚠️ 设置要求 (2/3)"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "5c7235c1-3745-48c2-9e8b-0734cf64afe3",
"connections": {
"Merge": {
"main": [
[
{
"node": "Get post_id for all new posts",
"type": "main",
"index": 0
}
]
]
},
"Insert X post": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 3
}
]
]
},
"Get Posts Info": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get word's list": {
"main": [
[
{
"node": "AnySite Search Reddit Posts",
"type": "main",
"index": 0
},
{
"node": "AnySite Search LinkedIn Posts",
"type": "main",
"index": 0
},
{
"node": "AnySite Search Instagram Posts",
"type": "main",
"index": 0
},
{
"node": "AnySite Search X Posts",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get word's list",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Update LN comments": {
"main": [
[]
]
},
"Insert Reddit post ": {
"main": [
[
{
"node": "AnySite Get Reddit Post Comment",
"type": "main",
"index": 0
},
{
"node": "AnySite Get Reddit Post",
"type": "main",
"index": 0
}
]
]
},
"Insert Instagram post": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Insert LinkedIn post ": {
"main": [
[
{
"node": "AnySite Get LinkedIn Post Comments",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"AnySite Search X Posts": {
"main": [
[
{
"node": "If X post does not exist3",
"type": "main",
"index": 0
}
]
]
},
"AnySite Get Reddit Post": {
"main": [
[
{
"node": "Update Reddit post details",
"type": "main",
"index": 0
}
]
]
},
"Send a message in Gmail": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"If X post does not exist3": {
"main": [
[
{
"node": "Insert X post",
"type": "main",
"index": 0
}
]
]
},
"Update Reddit post details": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"AnySite Search Reddit Posts": {
"main": [
[
{
"node": "If Reddit post does not exist",
"type": "main",
"index": 0
}
]
]
},
"Update Reddit post comments": {
"main": [
[]
]
},
"AnySite Search LinkedIn Posts": {
"main": [
[
{
"node": "If LinkedIn post does not exist1",
"type": "main",
"index": 0
}
]
]
},
"Get post_id for all new posts": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"If Reddit post does not exist": {
"main": [
[
{
"node": "Insert Reddit post ",
"type": "main",
"index": 0
}
]
]
},
"AnySite Search Instagram Posts": {
"main": [
[
{
"node": "If Instagram post does not exist2",
"type": "main",
"index": 0
}
]
]
},
"Convert comments to the string": {
"main": [
[
{
"node": "Update Reddit post comments",
"type": "main",
"index": 0
}
]
]
},
"AnySite Get Reddit Post Comment": {
"main": [
[
{
"node": "Convert comments to the string",
"type": "main",
"index": 0
}
]
]
},
"If LinkedIn post does not exist1": {
"main": [
[
{
"node": "Insert LinkedIn post ",
"type": "main",
"index": 0
}
]
]
},
"Convert LN comments to the string": {
"main": [
[
{
"node": "Update LN comments",
"type": "main",
"index": 0
}
]
]
},
"If Instagram post does not exist2": {
"main": [
[
{
"node": "Insert Instagram post",
"type": "main",
"index": 0
}
]
]
},
"AnySite Get LinkedIn Post Comments": {
"main": [
[
{
"node": "Convert LN comments to the string",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Get word's list",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
地缘政治突发新闻警报
使用AI评分和Telegram警报过滤地缘政治突发新闻
If
Code
Merge
+9
30 节点Dev Dutta
市场调研
使用GPT-4洞察和Slack交付自动化每周SEO报告
通过GPT-4洞察和Slack交付自动化每周SEO报告
Set
Code
Merge
+8
42 节点Marcelo Abreu
市场调研
基于 GPT-4 专家的全面 SEO 审计,使用 Analytics、Search Console 和 PageSpeed
基于 GPT-4 专家的全面 SEO 审计,使用 Analytics、Search Console 和 PageSpeed
Set
Code
Merge
+8
38 节点Jimmy Gay
市场调研
带 AI 过滤的个性化学习内容聚合器
使用 GPT-4.1-mini 和 Google Sheets 从 Reddit 和 RSS 筛选学习内容
Set
Code
Merge
+7
18 节点higashiyama
市场调研
创作者社交媒体趋势页面
使用 Reddit、Twitter 和 GPT-4o 追踪社交媒体趋势,同步至 SharePoint/Drive
Set
Code
Merge
+7
15 节点plemeo
市场调研
使用Slack和Asana的虚拟Scrum Master
基于AI的Scrum Master助手,集成OpenAI、Slack和Asana
Set
Code
Html
+10
35 节点Łukasz
项目管理
工作流信息
难度等级
高级
节点数量42
分类2
节点类型11
作者
Andrey
@kuliaCEO of AnySite.io | Agent-first web scraping APIs for LinkedIn, Instagram, Twitter & Reddit. Try our n8n nodes for reliable, self-healing data extraction. DM for custom integrations.
外部链接
在 n8n.io 查看 →
分享此工作流