8
n8n 中文网amn8n.com

使用RapidAPI和Google Sheets进行SEO竞争对手分析

中级

这是一个Market Research, Miscellaneous, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 If, Set, Wait, FormTrigger, HttpRequest 等节点。 使用RapidAPI和Google Sheets进行SEO竞争对手分析

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
  },
  "nodes": [
    {
      "id": "4ba10d81-f58d-49db-be31-8c4c870dec1d",
      "name": "全局存储",
      "type": "n8n-nodes-base.set",
      "position": [
        -1220,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6d160d8b-ab11-4f0a-a484-2e3f8f7f3033",
              "name": "website",
              "type": "string",
              "value": "={{ $json.Website }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bd802aa0-ade4-4265-949b-b5ce7cea6293",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -560,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3ec0a058-9e37-4363-a4da-b7937144be13",
              "operator": {
                "type": "object",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data }}",
              "rightValue": ""
            },
            {
              "id": "425822e3-7fd3-4758-a84d-7a2d11fcaad4",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.semrushAPI.organicCompetitors }}",
              "rightValue": ""
            },
            {
              "id": "b073fc07-7831-4715-9d45-ac37229241bb",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.semrushAPI.organicPages }}",
              "rightValue": ""
            },
            {
              "id": "cf43ccec-f2a5-4ea5-8394-b99710f9e6e4",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.semrushAPI.domainOrganicSearchKeywords }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3254616f-6f6b-4b81-bc9d-056dd8599a94",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        -200,
        220
      ],
      "webhookId": "9934772d-2ed5-4521-bf30-dea8156deb5d",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "ef80c50c-a2b8-47d4-ab0b-47b3f4cca7a3",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1480,
        20
      ],
      "webhookId": "04dfc8fa-fd49-46d6-afb1-21b4cca0e1cf",
      "parameters": {
        "options": {},
        "formTitle": "Competitor Analysis",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Website",
              "placeholder": "e.g. instagram.com",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Enter website domain to check competitor"
      },
      "typeVersion": 2.2
    },
    {
      "id": "737f5a72-18fb-48f7-9532-471fc19f39eb",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -200,
        -180
      ],
      "parameters": {
        "columns": {
          "value": {
            "Domain": "={{ $('Global Storage').item.json.website }}",
            "Organic Page": "={{ $json.data.semrushAPI.organicPages }}",
            "Organic competitor": "={{ $json.data.semrushAPI.organicCompetitors }}",
            "Domain organic search": "={{ $json.data.semrushAPI.domainOrganicSearchKeywords }}"
          },
          "schema": [
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organic competitor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organic competitor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organic Page",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organic Page",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain organic search",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain organic search",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "9b807b33-2f49-4d58-9fc9-2ff9e14d7439",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        260,
        200
      ],
      "parameters": {
        "columns": {
          "value": {
            "Domain": "={{ $('Global Storage').item.json.website }}",
            "Organic Page": "=Not data found.",
            "Organic competitor": "=Not data found.",
            "Domain organic search": "=Not data found."
          },
          "schema": [
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organic competitor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organic competitor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organic Page",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organic Page",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain organic search",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain organic search",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f4d9cc87-fdbb-4842-a9b4-19bb799444fd",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1540,
        -140
      ],
      "parameters": {
        "width": 220,
        "height": 320,
        "content": "### 1. 🟢 **表单提交时**"
      },
      "typeVersion": 1
    },
    {
      "id": "827c2ee8-778c-4823-a3cb-760d0261d3c3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -140
      ],
      "parameters": {
        "height": 320,
        "content": "### 2. 📦 **全局存储**"
      },
      "typeVersion": 1
    },
    {
      "id": "16a60929-44a8-4521-8a41-bf0db993fe5c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -140
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "### 3. 🌐 **竞争对手分析请求**"
      },
      "typeVersion": 1
    },
    {
      "id": "8c8ed73b-427b-4c62-9eac-80743d518ce2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -660,
        -160
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "### 4. ⚖️ **条件检查**"
      },
      "typeVersion": 1
    },
    {
      "id": "90e85218-3e39-4cb2-b175-7eb6fb681b7a",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        20
      ],
      "parameters": {
        "width": 360,
        "height": 340,
        "content": "### 6. ⏳ **等待节点(5秒间隔)**"
      },
      "typeVersion": 1
    },
    {
      "id": "b834649d-3233-402e-955c-a2813b041c3f",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -520
      ],
      "parameters": {
        "width": 360,
        "height": 500,
        "content": "### 5. 📊 **Google Sheets - 从响应体插入记录**"
      },
      "typeVersion": 1
    },
    {
      "id": "0c156367-aa5f-47ef-a9ba-e6e71bbea69e",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -160
      ],
      "parameters": {
        "width": 400,
        "height": 520,
        "content": "### 7. 📊 **Google Sheets - 插入'未找到'记录**"
      },
      "typeVersion": 1
    },
    {
      "id": "063d511c-30c5-4d1c-92f9-6455c4af7d73",
      "name": "竞争对手分析请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -900,
        20
      ],
      "parameters": {
        "url": "https://competitor-analysis2.p.rapidapi.com/competitor.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "website",
              "value": "={{ $json.website }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "competitor-analysis2.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4fccf5f4-5d91-4fb2-bd96-7f4ed5657c61",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2640,
        -420
      ],
      "parameters": {
        "width": 900,
        "height": 660,
        "content": "# 自动化 SEO 竞争对手分析和 Google Sheets 记录"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global Storage": {
      "main": [
        [
          {
            "node": "Competitor Analysis Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Global Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Analysis Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研, 杂项, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类3
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流