8
n8n 中文网amn8n.com

使用Gemini AI视觉分析与Telegram警报监控X平台品牌提及

高级

这是一个Miscellaneous, AI Summarization, Multimodal AI领域的自动化工作流,包含 24 个节点。主要使用 If, Set, Code, Switch, Airtable 等节点。 使用Gemini AI视觉分析与Telegram警报监控X平台品牌提及

前置要求
  • Airtable API Key
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "afca6c018fd85ecd6bb793dc620b1f9d2de9ea7edb2532dd2708b1a0cf01d640",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "103d7b99-a9df-40c7-9ed4-d7c9738d8ca9",
      "name": "如果是推文",
      "type": "n8n-nodes-base.if",
      "position": [
        -144,
        -128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7d16677e-6045-40e1-8926-6e754fe45c2d",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.type === 'tweet' }}",
              "rightValue": ""
            },
            {
              "id": "548064ee-0ddf-46f8-b827-08437628b83c",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.lang === $('Config').item.json.lang }}",
              "rightValue": ""
            },
            {
              "id": "afaa1330-1b72-410c-bb48-33b1ea1efaa3",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.card.isEmpty() }}",
              "rightValue": "null"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f20e6318-9d57-490e-b3f7-a3ded4622dc1",
      "name": "配置",
      "type": "n8n-nodes-base.set",
      "position": [
        -672,
        -128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2b13642a-d453-4338-943b-0b27d39ce3b3",
              "name": "lang",
              "type": "string",
              "value": "en"
            },
            {
              "id": "de62b7a8-be52-4208-8218-03ac673dbbad",
              "name": "actorId",
              "type": "string",
              "value": "kaitoeasyapi~twitter-x-data-tweet-scraper-pay-per-result-cheapest"
            },
            {
              "id": "cc4b39e1-4fa3-4855-9158-1c3501d5ebfe",
              "name": "searchTerms",
              "type": "string",
              "value": "(Tesla OR $TSLA OR Cybertruck OR \"Model Y\" OR FSD) -Nikola"
            },
            {
              "id": "32fcc432-e793-420b-85a4-74fcf5e7b966",
              "name": "min_faves",
              "type": "string",
              "value": "10"
            },
            {
              "id": "f326a257-1f18-4880-9e93-7c57b2a81616",
              "name": "tweetsToScrape",
              "type": "string",
              "value": "20"
            },
            {
              "id": "2c5d5c11-01db-4bdb-aaf5-92364c36f239",
              "name": "airtableBaseId",
              "type": "string",
              "value": "appfoRsukEzLhzNwS"
            },
            {
              "id": "70c29ffb-8b8a-4838-9770-a382d5b7d2ac",
              "name": "airtableTableId",
              "type": "string",
              "value": "tblO50wK1GsrweF7j"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "47f19a44-ddd4-48a2-93ec-36ea352a0b90",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -256
      ],
      "parameters": {
        "color": 2,
        "width": 608,
        "height": 464,
        "content": "## 仅获取推文"
      },
      "typeVersion": 1
    },
    {
      "id": "325c067c-b310-43f8-bca6-e31aa44ebfb9",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        512,
        -144
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "45aac11e-7d4a-420a-8491-8c2aab1ad828",
      "name": "如果是新内容",
      "type": "n8n-nodes-base.if",
      "position": [
        1008,
        -128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1b074293-6d3b-4fd8-916a-54ec64b56da3",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9a8225d7-4830-4e81-ab5b-8137df784988",
      "name": "帖子已存在",
      "type": "n8n-nodes-base.airtable",
      "position": [
        768,
        -128
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableBaseId }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableTableId }}"
        },
        "options": {},
        "operation": "search",
        "filterByFormula": "={postID}='{{ $json.post.id }}'"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "9dpMJbMZPf7Nfsw8",
          "name": "Airtable"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "9820bc4b-febb-4d9c-89dd-a9a3d4a44891",
      "name": "设置必填字段",
      "type": "n8n-nodes-base.set",
      "position": [
        176,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "41682df1-932d-4373-83a8-7516bad2245f",
              "name": "post.id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "249814ac-3491-485c-bb6e-4907bd55de5f",
              "name": "post.url",
              "type": "string",
              "value": "={{ $json.url }}"
            },
            {
              "id": "04c15380-02da-4a97-8e0f-d06f60b7403b",
              "name": "post.text",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "a2710583-74c3-497a-8bb6-de5fbee69ca1",
              "name": "post.lang",
              "type": "string",
              "value": "={{ $json.lang }}"
            },
            {
              "id": "23e6e90b-7fc3-4c51-bbfe-8fa25da32577",
              "name": "post.createdAt",
              "type": "string",
              "value": "={{ $json.createdAt.toDateTime().toISO() }}"
            },
            {
              "id": "b0bd2f75-ca94-4e3e-a2f2-5dbbe9f14a1d",
              "name": "author.userName",
              "type": "string",
              "value": "={{ $json.author.userName }}"
            },
            {
              "id": "749e1fe5-8c95-4522-8491-e24f542e211a",
              "name": "author.name",
              "type": "string",
              "value": "={{ $json.author.name }}"
            },
            {
              "id": "780b5a0f-62f6-4e7b-a22d-6f5c9ee98e3d",
              "name": "media.photos",
              "type": "array",
              "value": "={{ ($json.extendedEntities.media?.filter(item => item.type === 'photo').map(item => item.media_url_https).filter(url => url)) || [] }}"
            },
            {
              "id": "cafdf61f-ee05-4f7b-8c99-2460f93b41f4",
              "name": "media.videos",
              "type": "array",
              "value": "={{ \n\n($json.extendedEntities.media || []).map(item => (item.video_info?.variants || []).filter(v => v?.content_type === 'video/mp4' && v.bitrate != null).sort((a, b) => b.bitrate - a.bitrate)[0]?.url).filter(url => url)\n\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8bcdb545-1d9c-4855-a303-274f5f288c71",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2480,
        128
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"overallSentiment\": \"Positive\",\n  \"relevanceScore\": 8,\n  \"reasoning\": \"A one-sentence explanation for your decision, referencing both text and visuals if available.\",\n  \"photosSummary\": \"A concise, one to two-sentence summary of the entire post, combining insights from both the text and the images.\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "592b5157-405b-4c90-9ca3-e53900f5183a",
      "name": "Google Calendar MCP",
      "type": "n8n-nodes-base.switch",
      "position": [
        2672,
        -144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "High Relevance",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7b1ab8fb-30b5-448a-a5b1-0cd1dd09f2a1",
                    "operator": {
                      "type": "number",
                      "operation": "gt"
                    },
                    "leftValue": "={{ $json.output.relevanceScore }}",
                    "rightValue": 7
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Not Relevance",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "513914f6-3119-4809-a613-d8764d03ef46",
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    },
                    "leftValue": "={{ $json.output.relevanceScore }}",
                    "rightValue": 4
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Medium Relevance",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "82944e41-fbb3-481c-afc5-6b28b68b1704",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.output.relevanceScore }}",
                    "rightValue": 4
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5811f406-1f42-4b4b-a5b6-7d9268bdd4fb",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -928,
        -224
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c2f6205b-ad16-41a6-a48f-b93446a4ef26",
      "name": "完成!",
      "type": "n8n-nodes-base.noOp",
      "position": [
        768,
        -352
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "82727baa-5035-4129-a8a7-be20cb72f2f9",
      "name": "记录中等相关性帖子",
      "type": "n8n-nodes-base.airtable",
      "position": [
        3056,
        -96
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableBaseId }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableTableId }}"
        },
        "columns": {
          "value": {
            "postID": "={{ $('Loop Over Items').item.json.post.id }}",
            "status": "For Weekly Review",
            "postURL": "={{ $('Loop Over Items').item.json.post.url }}",
            "postLang": "={{ $('Loop Over Items').item.json.post.lang }}",
            "postText": "={{ $('Loop Over Items').item.json.post.text }}",
            "authorName": "={{ $('Loop Over Items').item.json.author.name }}",
            "aiSentiment": "={{ $json.output.overallSentiment }}",
            "mediaPhotos": "={{ $('Loop Over Items').item.json.media.photos.join(',') }}",
            "mediaVideos": "={{ $('Loop Over Items').item.json.media.videos.join(',') }}",
            "postCreatedAt": "={{ $('Loop Over Items').item.json.post.createdAt }}",
            "authorUserName": "={{ $('Loop Over Items').item.json.author.userName }}",
            "relevanceScore": "={{ $('Analyze Text and Photos').item.json.output.relevanceScore }}",
            "relevanceReasoning": "={{ $('Analyze Text and Photos').item.json.output.reasoning }}",
            "mediaPhotosAnalysis": "={{ $('Analyze Text and Photos').item.json.output.photosSummary}}"
          },
          "schema": [
            {
              "id": "postID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postURL",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postURL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postText",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postText",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postLang",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postLang",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postCreatedAt",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postCreatedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "authorUserName",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "authorUserName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "authorName",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "authorName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaPhotos",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaPhotos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaVideos",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaVideos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "aiSentiment",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Negative",
                  "value": "Negative"
                },
                {
                  "name": "Positive",
                  "value": "Positive"
                },
                {
                  "name": "Neutral",
                  "value": "Neutral"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "aiSentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "relevanceScore",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "relevanceScore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "relevanceReasoning",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "relevanceReasoning",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaPhotosAnalysis",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaPhotosAnalysis",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "New",
                  "value": "New"
                },
                {
                  "name": "Action Required",
                  "value": "Action Required"
                },
                {
                  "name": "Escalated",
                  "value": "Escalated"
                },
                {
                  "name": "For Weekly Review",
                  "value": "For Weekly Review"
                },
                {
                  "name": "Done",
                  "value": "Done"
                },
                {
                  "name": "Archived (No Action)",
                  "value": "Archived (No Action)"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "assignee",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "assignee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "9dpMJbMZPf7Nfsw8",
          "name": "Airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ec360fe2-b495-41fa-a719-e72edcbad854",
      "name": "记录高相关性帖子",
      "type": "n8n-nodes-base.airtable",
      "position": [
        3056,
        -352
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableBaseId }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').item.json.airtableTableId }}"
        },
        "columns": {
          "value": {
            "postID": "={{ $('Loop Over Items').item.json.post.id }}",
            "status": "New",
            "postURL": "={{ $('Loop Over Items').item.json.post.url }}",
            "postLang": "={{ $('Loop Over Items').item.json.post.lang }}",
            "postText": "={{ $('Loop Over Items').item.json.post.text }}",
            "authorName": "={{ $('Loop Over Items').item.json.author.name }}",
            "aiSentiment": "={{ $json.output.overallSentiment }}",
            "mediaPhotos": "={{ $('Loop Over Items').item.json.media.photos.join(',') }}",
            "mediaVideos": "={{ $('Loop Over Items').item.json.media.videos.join(',') }}",
            "postCreatedAt": "={{ $('Loop Over Items').item.json.post.createdAt }}",
            "authorUserName": "={{ $('Loop Over Items').item.json.author.userName }}",
            "relevanceScore": "={{ $('Analyze Text and Photos').item.json.output.relevanceScore }}",
            "relevanceReasoning": "={{ $('Analyze Text and Photos').item.json.output.reasoning }}",
            "mediaPhotosAnalysis": "={{ $('Analyze Text and Photos').item.json.output.photosSummary}}"
          },
          "schema": [
            {
              "id": "postID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postURL",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postURL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postText",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postText",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postLang",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postLang",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postCreatedAt",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "postCreatedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "authorUserName",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "authorUserName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "authorName",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "authorName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaPhotos",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaPhotos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaVideos",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaVideos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "aiSentiment",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Negative",
                  "value": "Negative"
                },
                {
                  "name": "Positive",
                  "value": "Positive"
                },
                {
                  "name": "Neutral",
                  "value": "Neutral"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "aiSentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "relevanceScore",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "relevanceScore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "relevanceReasoning",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "relevanceReasoning",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mediaPhotosAnalysis",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "mediaPhotosAnalysis",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "New",
                  "value": "New"
                },
                {
                  "name": "Action Required",
                  "value": "Action Required"
                },
                {
                  "name": "Escalated",
                  "value": "Escalated"
                },
                {
                  "name": "For Weekly Review",
                  "value": "For Weekly Review"
                },
                {
                  "name": "Done",
                  "value": "Done"
                },
                {
                  "name": "Archived (No Action)",
                  "value": "Archived (No Action)"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "assignee",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "assignee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "9dpMJbMZPf7Nfsw8",
          "name": "Airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "80c945ca-1a52-429e-816d-d15205d6704a",
      "name": "不感兴趣!",
      "type": "n8n-nodes-base.noOp",
      "position": [
        176,
        64
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b9964fcb-b810-4c1e-9b44-547906bbcfe0",
      "name": "分析帖子图片",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1680,
        -352
      ],
      "parameters": {
        "text": "=You are provided with several images. For EACH image, provide a brief description and its sentiment.\n\nRespond with a JSON object containing a list of your findings, structured like this:\n{\n  \"image_analyses\": [\n    { \"image_index\": 0, \"description\": \"...\", \"sentiment\": \"...\" },\n    { \"image_index\": 1, \"description\": \"...\", \"sentiment\": \"...\" }\n  ]\n}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $('Loop Over Items').item.json.media.photos.join(',') }}",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "vppVWKsiofTY92Ht",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "executeOnce": false,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "83bad7fe-b828-4802-8d23-79c65380c051",
      "name": "获取最终图片分析结果",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        -352
      ],
      "parameters": {
        "jsCode": "// 'items' is an array of all your inputs.\n// We loop through each one using .map().\nconst allData = $input.first().json.content.parts.map(item => {\n  // Get the raw text string from the current item.\n  const rawText = item.text;\n\n  // Find and extract the clean JSON string from the code block.\n  const match = rawText.match(/```json\\n([\\s\\S]*)\\n```/);\n  const jsonString = match ? match[1] : '{}'; // Default to empty object if no match\n\n  // Parse the string into a real JSON object.\n  return JSON.parse(jsonString);\n});\n\n// Return a single new item containing the array of all parsed data.\nreturn [{\n  json: {\n    photos_results: allData\n  },\n  // The index of the input item that generated this output item\n  \"pairedItem\": 0\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "2dfef403-c35d-4500-8cd1-1f4b1079a48b",
      "name": "如果包含图片",
      "type": "n8n-nodes-base.if",
      "position": [
        1312,
        -144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0220f75b-64a3-430c-ac44-887c7be35ece",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Loop Over Items').item.json.media.photos.isNotEmpty() }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f819b63c-9f44-40fb-bc46-a8cbec06e605",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        -480
      ],
      "parameters": {
        "color": 3,
        "width": 672,
        "height": 416,
        "content": "## 分析帖子图片"
      },
      "typeVersion": 1
    },
    {
      "id": "d17ee8c7-0727-481c-8422-26c9fb001ca6",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        -352
      ],
      "parameters": {
        "color": 5,
        "width": 704,
        "height": 656,
        "content": "## 检查帖子与品牌相关性"
      },
      "typeVersion": 1
    },
    {
      "id": "b26f7535-de62-456b-a8bd-338c91311e24",
      "name": "爬取X",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -448,
        -128
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/acts/{{ $json.actorId }}/run-sync-get-dataset-items",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"filter:blue_verified\": false,\n  \"filter:consumer_video\": false,\n  \"filter:has_engagement\": false,\n  \"filter:hashtags\": false,\n  \"filter:images\": true,\n  \"filter:links\": false,\n  \"filter:media\": false,\n  \"filter:mentions\": false,\n  \"filter:native_video\": false,\n  \"filter:nativeretweets\": false,\n  \"filter:news\": false,\n  \"filter:pro_video\": false,\n  \"filter:quote\": false,\n  \"filter:replies\": false,\n  \"filter:safe\": false,\n  \"filter:spaces\": false,\n  \"filter:twimg\": false,\n  \"filter:videos\": false,\n  \"filter:vine\": false,\n  \"include:nativeretweets\": false,\n  \"lang\": \"{{ $json.lang }}\",\n  \"searchTerms\": [\n    {{ $json.searchTerms.toJsonString() }}\n  ],\n  \"since\": \"{{ new Date(Date.now() - 86400000).toISOString().slice(0, 19).replace('T', '_') + '_UTC'; }}\",\n  \"maxItems\": {{ $json.tweetsToScrape }},\n  \"queryType\": \"Latest\",\n  \"min_retweets\": 0,\n  \"min_faves\": {{ $json.min_faves }},\n  \"min_replies\": 0,\n  \"-min_retweets\": 0,\n  \"-min_faves\": 0,\n  \"-min_replies\": 0\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "Fu6O8UOTEpfPXgyP",
          "name": "Apify"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cd7a5fbe-d569-41a5-99be-7c944b8d902c",
      "name": "手动执行",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -928,
        -32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f4c16426-20af-4d2f-b004-501a5a602494",
      "name": "发送高相关性帖子至监控群组",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3264,
        -352
      ],
      "webhookId": "376c4c49-f408-4b40-96f7-6c6f79c5cee8",
      "parameters": {
        "text": "=<b>🔥 New High-Relevance Tesla Mention! 🔥</b>\n\n<i>Author:</i> {{ $('Loop Over Items').item.json.author.name }} (@{{ $('Loop Over Items').item.json.author.userName }})\n<i>Sentiment:</i> <code>{{ $('Analyze Text and Photos').item.json.output.overallSentiment }}</code>\n<i>Relevance Score:</i> <code>{{ $('Analyze Text and Photos').item.json.output.relevanceScore }}/10</code>\n\n<blockquote>{{ $('Loop Over Items').item.json.post.text }}</blockquote>\n\n<a href=\"{{ $('Loop Over Items').item.json.post.url }}\">Link to Tweet</a>\n\n",
        "chatId": "-4956947485",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "RDdscBadRkYP5zeG",
          "name": "Telegram (n8n)"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "df071519-f247-443c-9eb9-f855a677b614",
      "name": "分析文本和图片",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2320,
        -128
      ],
      "parameters": {
        "text": "=Perform a final analysis based on the following data.\n\n--- Post Text ---\n\"\"\"\n{{ $('Loop Over Items').item.json.post.text }}\n\"\"\"\n\n--- Image Analysis (JSON) ---\n\"\"\"\n{{ $('Get Final Photos Analysis Results').isExecuted ? ($json.photos_results ? JSON.stringify($json.photos_results) : \"No images were included in this post.\") : \"No images were included in this post.2\"}}\n\"\"\"\n\n",
        "options": {
          "systemMessage": "=You are a Head Brand Strategist for Tesla. Your job is to synthesize the provided analyses of a social media post's text and visuals into a final, conclusive assessment.\n\n--- Brand Context ---\n- Brand Identifiers: \"Tesla\", \"$TSLA\"\n- Core Products: \"Model S\", \"Model 3\", \"Model Y\", \"Cybertruck\", \"Autopilot\", \"FSD\"\n- Nuance: Ignore mentions of \"Nikola Tesla\" the inventor.\n\n--- Your Task ---\n1.  First, look at the `Image Analysis (JSON)`. Synthesize the individual image descriptions into a single, one-sentence summary for the `photosSummary` field.\n2.  **Crucial Rule:** If the `Image Analysis` section says \"No images were included in this post\", you MUST return an empty string (\"\") for the `photosSummary` field.\n3.  Then, using all available information (the `Post Text` and your new `photoSummary`), determine the final sentiment, relevance, and a suggested status.\n\n--- Output Format ---\nRespond ONLY with a single, valid JSON object with this exact structure:\n{\n  \"overallSentiment\": \"Positive\", \"Negative\", or \"Neutral\",\n  \"relevanceScore\": integer (0-10),\n  \"reasoning\": \"A one-sentence explanation for your decision, referencing both text and visuals if available.\",\n  \"photosSummary\": \"A one-sentence summary of the visual story from the images, OR an empty string if there are no images.\"\n}\n",
          "passthroughBinaryImages": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "27dfc0d8-93dc-4b25-9ea1-be9429ca267b",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2304,
        128
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "vppVWKsiofTY92Ht",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Scrape X",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If New": {
      "main": [
        [
          {
            "node": "If Has Photos",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Log the High Relevance Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log the Medium Relevance Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Tweet": {
      "main": [
        [
          {
            "node": "Set Required Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not Interested!",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape X": {
      "main": [
        [
          {
            "node": "If Tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Exists": {
      "main": [
        [
          {
            "node": "If New",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Has Photos": {
      "main": [
        [
          {
            "node": "Analyze Post Photos",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Analyze Text and Photos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Done!",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Executing": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Post Photos": {
      "main": [
        [
          {
            "node": "Get Final Photos Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Required Fields": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Text and Photos": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Text and Photos",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Text and Photos",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Log the High Relevance Post": {
      "main": [
        [
          {
            "node": "Send High Relevance Post to Monitoring Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log the Medium Relevance Post": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Final Photos Analysis Results": {
      "main": [
        [
          {
            "node": "Analyze Text and Photos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send High Relevance Post to Monitoring Group": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 杂项, AI 摘要总结, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量24
分类3
节点类型16
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

Hi 👋 I design automation workflows with n8n, AI, and custom APIs. My focus is on building reliable systems that save time and boost productivity. Always happy to answer questions about my templates.

外部链接
在 n8n.io 查看

分享此工作流