8
n8n 中文网amn8n.com

HubSpot 联系人同步(含 LinkedIn URL)、变更检测与 Gmail 提醒

高级

这是一个Sales, IT Ops领域的自动化工作流,包含 46 个节点。主要使用 If, Set, Code, Gmail, Merge 等节点。 同步 HubSpot 联系人(含 LinkedIn URL),检测变更并发送 Gmail 提醒

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "2804a082-c17b-482f-828d-901dab7e7a11",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -160,
        40
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "58d51340-5246-4089-ae63-f16ff4be184e",
      "name": "获取所有者列表",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        40
      ],
      "parameters": {
        "url": "https://api.hubapi.com/crm/v3/owners",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotOAuth2Api"
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "id": "qubiIFrowxvUdpu6",
          "name": "HubSpot account for node"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "335ffd8c-68fa-4d55-85e9-462963a8a291",
      "name": "获取所有者的客户列表",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        575
      ],
      "parameters": {
        "url": "https://api.hubapi.com/crm/v3/objects/contacts/search",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"filterGroups\": [\n    {\n      \"filters\": [\n        {\n          \"propertyName\": \"hubspot_owner_id\",\n          \"operator\": \"EQ\",\n          \"value\": \"{{ $('When Executed by Another Workflow').item.json.ownerId }}\"\n        }\n      ]\n    }\n  ],\n  \"properties\": [\"firstname\", \"lastname\", \"email\", \"linkedinURL\", \"company\"],\n\"limit\": 200,\n\"after\": {{ $node['Edit'].json[\"sofar\"] }}\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotOAuth2Api"
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "id": "qubiIFrowxvUdpu6",
          "name": "HubSpot account for node"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5d116139-1764-4d3a-8696-d280fb7e9d8f",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -210,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "height": 460,
        "content": "## 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "a8a15bd4-5a46-4f70-87bd-4db7170b4928",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        575
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d5df6d6c-ff5f-46ad-a8d4-38e326d7415e",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $node['Edit'].json.sofar }}",
              "rightValue": "={{ $('Get list of clients for owner').item.json.total }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "eda30bd9-95bb-43d4-8981-479036103dd1",
      "name": "编辑",
      "type": "n8n-nodes-base.set",
      "position": [
        60,
        575
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8a403dc5-2b05-430d-b1cc-39f70f5ac82d",
              "name": "sofar",
              "type": "number",
              "value": "=0"
            },
            {
              "id": "dca65b15-f545-42f1-90df-37efb03e267d",
              "name": "results",
              "type": "array",
              "value": "[]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4c6c8217-6610-413e-8b1c-185a96e44882",
      "name": "递增页码",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        500
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "sofar",
              "value": "={{$node[\"Edit\"].json[\"sofar\"] = $node[\"Edit\"].json[\"sofar\"] + $('Get list of clients for owner').item.json.results.length}}"
            }
          ]
        },
        "options": {}
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "58f53fe6-36a4-4385-ba93-e15dd589c0a4",
      "name": "拆分输出1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1160,
        575
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results"
      },
      "typeVersion": 1
    },
    {
      "id": "c92983ba-bef3-463a-a6de-8f205822f359",
      "name": "合并所有条目",
      "type": "n8n-nodes-base.code",
      "position": [
        940,
        575
      ],
      "parameters": {
        "jsCode": "let results = [],\n  i = 0;\n\ndo {\n  try {\n    results = results.concat($(\"Get list of clients for owner\").all(0, i));\n  } catch (error) {\n    console.log(results)\n    return results;\n  }\n  i++;\n} while (true);"
      },
      "typeVersion": 2
    },
    {
      "id": "68c51fbd-3845-4eb2-9204-d78cc30413bf",
      "name": "如果 LinkedIn URL 为空",
      "type": "n8n-nodes-base.if",
      "position": [
        1820,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "84952199-2e1d-4ea8-bfb8-d4aa975d6df1",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.linkedin_url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "18e4e4bd-4039-4770-a3d0-13edafe6103c",
      "name": "如果是新帖子",
      "type": "n8n-nodes-base.if",
      "position": [
        3580,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "48d6777d-5431-4cb9-9716-5059277bac5e",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Get rows from document').item.json['last post'] }}",
              "rightValue": "={{ $('Set last_post').item.json.last_post }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a5623af7-6fba-43b0-be50-c9d3c52aba32",
      "name": "获取客户列表",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        940,
        40
      ],
      "parameters": {
        "mode": "each",
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}",
          "cachedResultName": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {
            "ownerId": "={{ $json.id }}"
          },
          "schema": [
            {
              "id": "ownerId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ownerId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ownerId"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9f771153-6b83-4ac0-b642-ee2d4b65a41c",
      "name": "当由另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -160,
        575
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "ownerId"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "437dc3e5-0340-41ce-aea1-36749bd054ad",
      "name": "获取最后帖子",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        3140,
        40
      ],
      "parameters": {
        "mode": "each",
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "rnVcO8Bw0avTm4GB",
          "cachedResultName": "get personal posts for agent"
        },
        "workflowInputs": {
          "value": {
            "maxItems": 1,
            "username": "={{ $json.username }}",
            "responseType": "detail"
          },
          "schema": [
            {
              "id": "username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "responseType",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "responseType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "maxItems",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "maxItems",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "posted_after",
              "display": true,
              "required": false,
              "displayName": "posted_after",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a0dda2f2-cb89-4557-8cfc-5e3a01e34637",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4680,
        140
      ],
      "webhookId": "eea16996-1d02-4861-b83d-6145cee90ac6",
      "parameters": {
        "sendTo": "={{ $('Set data here').first().json.email }}",
        "message": "={{ $json.text }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "Changes in your clients",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "DLjspol9TLgpGaXa",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "99911831-e603-454c-b533-2e387f2008c4",
      "name": "通过链接搜索用户",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Search by Name and company",
      "position": [
        2920,
        140
      ],
      "parameters": {
        "url": "https://linkedin-api8.p.rapidapi.com/get-profile-data-by-url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.profileURL }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "linkedin-api8.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nhoVFnkO31mejJrI",
          "name": "RapidAPI Key"
        }
      },
      "executeOnce": false,
      "notesInFlow": true,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "903f6be4-b468-488c-aa41-50f60ee92bcb",
      "name": "不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2480,
        -160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "695202d6-60bd-4788-b029-0c03a9e3c89a",
      "name": "合并个人资料 URL",
      "type": "n8n-nodes-base.code",
      "position": [
        2700,
        140
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Add a new field called 'myNewField' to the JSON of the item\n$input.item.json.profileURL = $json.profileURL;\n\nreturn $input.item;"
      },
      "typeVersion": 2
    },
    {
      "id": "ead5d235-7f73-41e4-86d3-48ad7d4cfa8d",
      "name": "设置最后帖子",
      "type": "n8n-nodes-base.set",
      "position": [
        3360,
        40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "93be271c-22c8-4afe-a928-e9d2593b025d",
              "name": "last_post",
              "type": "string",
              "value": "={{ $json.text[0] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a89746c8-5fb7-4c69-930f-d0f451bcef54",
      "name": "设置最后职位",
      "type": "n8n-nodes-base.set",
      "position": [
        3360,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "93be271c-22c8-4afe-a928-e9d2593b025d",
              "name": "last_position",
              "type": "string",
              "value": "={{ $json.position[0].title }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "467aa5a3-c9f5-407f-8571-e9ba333109e2",
      "name": "如果是新职位",
      "type": "n8n-nodes-base.if",
      "position": [
        3580,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "48d6777d-5431-4cb9-9716-5059277bac5e",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.last_position }}",
              "rightValue": "={{ $('Get rows from document').item.json['current position'] }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f6456ca1-bb31-4bf3-8175-7f8b5f4a65bb",
      "name": "在此设置数据",
      "type": "n8n-nodes-base.set",
      "position": [
        60,
        40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a43825a4-f9cd-4b38-975c-b1de771cebea",
              "name": "sheetLink",
              "type": "string",
              "value": "https://docs.google.com/spreadsheets/d/1y17jIU6JnNPcmazWf2GsmRpdjBBMnkN41tRJnAO5KrQ/edit?gid=0#gid=0"
            },
            {
              "id": "ea837d0b-e8d6-4594-9861-550d30f05db0",
              "name": "email",
              "type": "string",
              "value": "zeerobug@gmail.com"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f904c3fb-9320-4b5e-92af-c7cc697eb9dc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 230,
        "height": 460,
        "content": "## Hubspot API"
      },
      "typeVersion": 1
    },
    {
      "id": "5a499d0c-bbe5-4041-a082-6111658bf155",
      "name": "更改此项用于测试",
      "type": "n8n-nodes-base.filter",
      "position": [
        1160,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "45031804-4846-4b03-8c8f-8f1a747986a4",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.properties.email }}",
              "rightValue": "=nuno.domingues@toyotacaetano.pt"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "089690f8-ddf5-46e4-933c-152095ea02ac",
      "name": "使用电子邮件创建条目",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1380,
        40
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $json.properties.email }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last post",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "last post",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current position",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "current position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gdLmm513ROUyH6oU",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "60617dc9-021b-41be-b7bf-0816bddba05e",
      "name": "从文档获取行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1600,
        40
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.email }}",
              "lookupColumn": "email"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gdLmm513ROUyH6oU",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "21c2bbd5-75f1-4c80-a4ec-4c2870890fcf",
      "name": "按名称搜索用户个人资料",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Search by Name and company",
      "position": [
        2040,
        -60
      ],
      "parameters": {
        "url": "https://linkedin-api8.p.rapidapi.com/search-people",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "firstName",
              "value": "={{ $('Get list of clients').item.json.properties.firstname }}"
            },
            {
              "name": "lastName",
              "value": "={{ $('Get list of clients').item.json.properties.lastname }}"
            },
            {
              "name": "company",
              "value": "={{ $('Get list of clients').item.json.properties.company }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "linkedin-api8.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nhoVFnkO31mejJrI",
          "name": "RapidAPI Key"
        }
      },
      "executeOnce": false,
      "notesInFlow": true,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "1a6f6571-a89a-4e6e-82a5-c239661d6131",
      "name": "个人资料 URL 未找到?",
      "type": "n8n-nodes-base.if",
      "position": [
        2260,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c561dcaf-e164-46e5-8f44-8ebcd2943c78",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.items[0].profileURL }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2811ca64-1e43-4934-abc2-f1a746b2cf68",
      "name": "设置个人资料 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        2480,
        40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d6d3ebce-153c-44b0-a2f8-3c8ac41381cb",
              "name": "profileURL",
              "type": "string",
              "value": "={{ $json.data.items[0].profileURL }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d79a3896-e5b3-4b63-ad04-848f34db8100",
      "name": "设置个人资料 URL1",
      "type": "n8n-nodes-base.set",
      "position": [
        2480,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d433d14f-b862-4f43-969e-5e911a138f8c",
              "name": "profileURL",
              "type": "string",
              "value": "={{ $('Get rows from document').item.json.linkedin_url }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "73683bde-7431-47e2-b70f-8e0dd2725c84",
      "name": "更新最后帖子",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3800,
        40
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "= {{new Date().format('dd-MM-yyyy')}}",
            "email": "={{ $('Change this for testing').item.json.properties.email }}",
            "last post": "={{ $('Set last_post').item.json.last_post }}",
            "linkedin_url": "={{ $('Merge profileURL').item.json.profileURL }}",
            "current position": "={{ $json.last_position }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last post",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "last post",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current position",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gdLmm513ROUyH6oU",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "71f66801-3b12-4633-a95b-c4c8788117bd",
      "name": "更新最后职位",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3800,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "= {{new Date().format('dd-MM-yyyy')}}",
            "email": "={{ $('Change this for testing').item.json.properties.email }}",
            "linkedin_url": "={{ $('Merge profileURL').item.json.profileURL }}",
            "current position": "={{ $json.last_position }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last post",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "last post",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current position",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Set data here').first().json.sheetLink }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gdLmm513ROUyH6oU",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d67c1106-5d91-4d00-980b-1b3578a1c86f",
      "name": "设置帖子已更新",
      "type": "n8n-nodes-base.set",
      "position": [
        4020,
        40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "71118d71-0ea6-4b01-ac4d-a3ae1129b0e7",
              "name": "post_updated",
              "type": "boolean",
              "value": true
            },
            {
              "id": "f709a120-0db7-4b50-82e6-8f1f02352680",
              "name": "email",
              "type": "string",
              "value": "={{ $('Change this for testing').item.json.properties.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ad574631-3799-4f02-96ff-8683dc944331",
      "name": "设置职位已更新",
      "type": "n8n-nodes-base.set",
      "position": [
        4020,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "71118d71-0ea6-4b01-ac4d-a3ae1129b0e7",
              "name": "position_updated",
              "type": "boolean",
              "value": true
            },
            {
              "id": "1f0e817d-2ad4-4330-b683-64e31cfa4741",
              "name": "email",
              "type": "string",
              "value": "={{ $('Change this for testing').item.json.properties.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "157a5e8f-7b42-4115-91a2-2f204cd6d9f6",
      "name": "生成电子邮件文本",
      "type": "n8n-nodes-base.code",
      "position": [
        4460,
        140
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet client_post = []\nlet client_position = []\nfor (const item of $input.all()) {\n  if(item.json.position_updated) {\n    client_position.push(item.json.email)\n  }\n  if(item.json.post_updated) {\n    client_post.push(item.json.email)\n  }\n}\nlet text = ''\nif (client_post.length > 0) {\n  text = text + 'There has been a post update for the following clients:\\n'\n  text = text + client_post.join(\"\\n\") + \"\\n\";\n}\nif (client_position.length > 0) {\n  text = text + 'There has been a position update for the following clients:\\n'\n  text = text + client_position.join(\"\\n\") + \"\\n\";\n}\n\nreturn {text};"
      },
      "typeVersion": 2
    },
    {
      "id": "0735e123-47ed-4b3c-9aa8-cc7d2f982e4b",
      "name": "按电子邮件合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        4240,
        140
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "keepEverything",
        "fieldsToMatchString": "email"
      },
      "typeVersion": 3.1
    },
    {
      "id": "88717813-9e07-4984-8e8b-7772f7c7a0e7",
      "name": "分割所有者",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        500,
        40
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results"
      },
      "typeVersion": 1
    },
    {
      "id": "5799995c-659e-4732-a35b-893692d95509",
      "name": "获取当前所有者",
      "type": "n8n-nodes-base.filter",
      "position": [
        720,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7c6aec6e-66a9-4739-8a59-28f2ab1c4a26",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": "={{ $('Set data here').first().json.email }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "637b821f-8051-4e91-a58e-85dc7e136467",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 230,
        "height": 460,
        "content": "## 调用子工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "3bda132e-73a3-4af0-bb43-ff52f31f5a90",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 190,
        "height": 460,
        "content": "## 用于测试"
      },
      "typeVersion": 1
    },
    {
      "id": "13fb80f1-d685-4998-a534-41a0f944b6e8",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 430,
        "height": 460,
        "content": "## 准备 Google 表格"
      },
      "typeVersion": 1
    },
    {
      "id": "54a51950-a284-435e-8a2b-bdc0ebace3c9",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3080,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 1090,
        "height": 660,
        "content": "## 添加其他测试"
      },
      "typeVersion": 1
    },
    {
      "id": "4b197665-b31c-4fa2-8934-5b72468ca2e9",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1960,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 1090,
        "height": 660,
        "content": "## 搜索 LinkedIn URL"
      },
      "typeVersion": 1
    },
    {
      "id": "665fb602-dc0a-432f-a087-ce6097f58937",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4200,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 670,
        "height": 660,
        "content": "## 生成警报电子邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "d6789f6a-aa62-44fd-9314-fc0157b6dcd8",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        400
      ],
      "parameters": {
        "color": 5,
        "width": 1570,
        "height": 460,
        "content": "## 获取此所有者的所有客户"
      },
      "typeVersion": 1
    },
    {
      "id": "d9a5cc09-7e4f-488a-a3dc-6a27361d9d0b",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -480
      ],
      "parameters": {
        "width": 640,
        "height": 200,
        "content": "## 联系我"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Merge al the entries",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get list of clients for owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit": {
      "main": [
        [
          {
            "node": "Get list of clients for owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out1": {
      "main": [
        []
      ]
    },
    "if new post": {
      "main": [
        [
          {
            "node": "Update last post",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get last post": {
      "main": [
        [
          {
            "node": "Set last_post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set data here": {
      "main": [
        [
          {
            "node": "Get list of owners",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set last_post": {
      "main": [
        [
          {
            "node": "if new post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Increment Page": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge on email": {
      "main": [
        [
          {
            "node": "Generate the email text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if new position": {
      "main": [
        [
          {
            "node": "Updates last position",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge profileURL": {
      "main": [
        [
          {
            "node": "Search for user by link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set post_updated": {
      "main": [
        [
          {
            "node": "Merge on email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out owners": {
      "main": [
        [
          {
            "node": "Get current owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update last post": {
      "main": [
        [
          {
            "node": "Set post_updated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get current owner": {
      "main": [
        [
          {
            "node": "Get list of clients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set last_position": {
      "main": [
        [
          {
            "node": "if new position",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get list of owners": {
      "main": [
        [
          {
            "node": "Split Out owners",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get list of clients": {
      "main": [
        [
          {
            "node": "Change this for testing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the profile URL": {
      "main": [
        [
          {
            "node": "Merge profileURL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge al the entries": {
      "main": [
        [
          {
            "node": "Split Out1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set position_updated": {
      "main": [
        [
          {
            "node": "Merge on email",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set the profile URL1": {
      "main": [
        [
          {
            "node": "Merge profileURL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Updates last position": {
      "main": [
        [
          {
            "node": "Set position_updated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get rows from document": {
      "main": [
        [
          {
            "node": "If linkedin url is empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Profile URL not found?": {
      "main": [
        [
          {
            "node": "Do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set the profile URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change this for testing": {
      "main": [
        [
          {
            "node": "Create entry with email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create entry with email": {
      "main": [
        [
          {
            "node": "Get rows from document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate the email text": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for user by link": {
      "main": [
        [
          {
            "node": "Get last post",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set last_position",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If linkedin url is empty": {
      "main": [
        [
          {
            "node": "Search for user profile by names",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set the profile URL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get list of clients for owner": {
      "main": [
        [
          {
            "node": "Increment Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for user profile by names": {
      "main": [
        [
          {
            "node": "Profile URL not found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set data here",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 销售, IT 运维

需要付费吗?

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

工作流信息
难度等级
高级
节点数量46
分类2
节点类型14
难度说明

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

作者
PollupAI

PollupAI

@zeerobug

We create bespoke AI solutions, automations and agents that help your business as it scales.

外部链接
在 n8n.io 查看

分享此工作流