8
n8n 中文网amn8n.com

基于AI的潜在客户研究与个性化邮件生成(Groq和Google Sheets)

高级

这是一个Lead Nurturing, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 If, Code, GoogleSheets, ManualTrigger, SplitInBatches 等节点。 基于AI的潜在客户研究与个性化邮件生成:使用Groq和Google Sheets

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "819f3d1c972a238903b1d9ec815f3780343ba88480484fe5c47770edd77c8a8f"
  },
  "nodes": [
    {
      "id": "aef4dd12-816e-4017-a951-dc2c6a0b8a1e",
      "name": "条件判断1",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        -100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f9f45046-3aac-41f1-939d-3269646e542f",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json[\"Hasil Riset\"] }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3205240f-3653-4e0d-a638-2044a4a0a253",
      "name": "搜索互联网1",
      "type": "@tavily/n8n-nodes-tavily.tavilyTool",
      "position": [
        560,
        0
      ],
      "parameters": {
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "options": {},
        "descriptionType": "manual",
        "toolDescription": "Get latest news/description on topic that user want to reseaarch"
      },
      "credentials": {
        "tavilyApi": {
          "id": "dNQcQ1QJtmgxWqia",
          "name": "Tavily account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6e9e4bcc-a713-421c-bac6-2901ca810723",
      "name": "公司调研1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -360,
        -40
      ],
      "parameters": {
        "text": "=You are an expert business analyst. Your task is to research the company: {{ $json.Perusahaan }}.\n\nYour output must be a comprehensive description that identifies the company's name, its core business, and potential opportunities for improving efficiency and effectiveness by implementing AI solutions.\n\nUse the 'Search Internet' tool to gather the latest information.\n\nStrictly base your analysis on the data found through the internet search. Do not hallucinate or invent information.\n\nYour final output must be only the text description. Do not include any introductory sentences or greetings.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "3f1d292f-a909-4b22-bbbf-3843cdd0913a",
      "name": "Groq 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        400,
        60
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "1RUvuOYI4v2AlIzb",
          "name": "Groq account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c075d4d7-ac55-4a4b-884e-67138d50a0c4",
      "name": "更新状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        180,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Leads",
            "Perusahaan": "={{ $('If1').item.json.Perusahaan }}"
          },
          "schema": [
            {
              "id": "Nama",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nama",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Jabatan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Jabatan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Perusahaan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Perusahaan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasil Riset",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Hasil Riset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send Email Perkenalan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Kirim email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Kirim email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Perkenalan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Perusahaan"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a22f8ce1-bf68-408a-ba00-7f1ac83a7211",
      "name": "更新描述",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -20,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Perusahaan": "={{ $('If1').item.json.Perusahaan }}",
            "Hasil Riset": "={{ $json.output }}"
          },
          "schema": [
            {
              "id": "Nama",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nama",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Jabatan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Jabatan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Perusahaan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Perusahaan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasil Riset",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Hasil Riset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send Email Perkenalan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Kirim email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Kirim email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Perkenalan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Send email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Respon Email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Perusahaan"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "89dd2953-8fe2-4798-879f-d92d1eb77c4d",
      "name": "获取模板",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -520,
        540
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.Status }}",
              "lookupColumn": "Tahap"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 102550433,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=102550433",
          "cachedResultName": "Template"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "eb74fb86-f67d-474b-a021-1077e6f7fa99",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        980,
        580
      ],
      "parameters": {
        "jsonSchemaExample": "{\n    \"emailSubject\":\"Subject email \",\n    \"emailBody\": \"body email lengkap\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "2dde3089-fb2a-4c20-a19a-ee75f250aebd",
      "name": "起草邮件",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        120,
        540
      ],
      "parameters": {
        "columns": {
          "value": {
            "Perusahaan": "={{ $('If1').item.json.Perusahaan }}",
            "Send Email Perkenalan": "={{ $json.output }}"
          },
          "schema": [
            {
              "id": "Nama",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nama",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Jabatan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Jabatan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Perusahaan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Perusahaan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasil Riset",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Hasil Riset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send Email Perkenalan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Kirim email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Kirim email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Perkenalan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Perusahaan"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "=gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b2e44f4b-50f3-4bb6-9d60-ac6787f8c1b0",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1320,
        -100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "65a91454-d953-4a14-b115-012cc5af41bb",
      "name": "获取表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1100,
        -100
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "9ee78456-5839-48b5-a89d-1bc1855e6607",
      "name": "输入链接",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        540
      ],
      "parameters": {
        "columns": {
          "value": {
            "Perusahaan": "={{ $('If1').item.json.Perusahaan }}",
            "Kirim email": "=https://n8n-brccptxv.ap-southeast-1.clawcloudrun.com/webhook/18169b76-7b07-4fce-95c4-7e5bb6244ed1/send-email/{{ $json.perusahaan_url_encoded }}"
          },
          "schema": [
            {
              "id": "Nama",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nama",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Jabatan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Jabatan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Perusahaan",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Perusahaan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasil Riset",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Hasil Riset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send Email Perkenalan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Kirim email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Kirim email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Perkenalan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Perkenalan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Follow up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Send email Follow up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Send email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Respon Email Follow up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Respon Email Follow up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Perusahaan"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=0",
          "cachedResultName": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "20ca4e42-14f9-4393-92d4-32c6da0ba6c9",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        540
      ],
      "parameters": {
        "jsCode": "// Array untuk menampung hasil yang akan dikirim ke node selanjutnya\nconst outputItems = [];\n\n// Loop melalui setiap item yang masuk dari node sebelumnya\nfor (const item of items) {\n  try {\n    // 1. Ambil nama perusahaan dari object JSON\n    // Pastikan key 'Perusahaan' ada di dalam data Anda\n    const namaPerusahaan = item.json.Perusahaan;\n\n    // 2. Lakukan replace spasi dengan '%20'\n    // Menggunakan encodeURIComponent() adalah cara yang paling tepat dan aman\n    // untuk mempersiapkan string sebagai bagian dari URL.\n    // Ini tidak hanya mengganti spasi, tapi juga karakter spesial lainnya.\n    const namaPerusahaanEncoded = encodeURIComponent(namaPerusahaan);\n\n    // Alternatif jika Anda HANYA ingin mengganti spasi:\n    // const namaPerusahaanEncoded = namaPerusahaan.replace(/ /g, '%20');\n\n    // 3. Buat object baru untuk output\n    // Anda bisa menyertakan data asli jika perlu dengan '...item.json'\n    const outputData = {\n      ...item.json, // Menyalin semua data asli\n      perusahaan_url_encoded: namaPerusahaanEncoded // Menambahkan field baru dengan hasil replace\n    };\n\n    // Tambahkan hasil ke dalam array output\n    outputItems.push({ json: outputData });\n\n  } catch (error) {\n    // Jika terjadi error (misalnya key 'Perusahaan' tidak ditemukan),\n    // teruskan item tersebut tanpa perubahan untuk menghindari workflow berhenti.\n    outputItems.push(item);\n  }\n}\n\n// Kembalikan semua item yang telah diproses untuk digunakan oleh node selanjutnya\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "781e118b-7062-4f1c-aeb3-a025f9740844",
      "name": "搜索互联网2",
      "type": "@tavily/n8n-nodes-tavily.tavilyTool",
      "position": [
        840,
        640
      ],
      "parameters": {
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "options": {},
        "descriptionType": "manual",
        "toolDescription": "Get latest news/description on topic that user want to reseaarch"
      },
      "credentials": {
        "tavilyApi": {
          "id": "dNQcQ1QJtmgxWqia",
          "name": "Tavily account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dfab319e-a76d-4c72-a0e9-6d8120efc0f5",
      "name": "遍历项目1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -580,
        -40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "6db18626-365c-4071-a777-7e4c56455f74",
      "name": "Groq 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        700,
        580
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "1RUvuOYI4v2AlIzb",
          "name": "Groq account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "256aaaca-a8a1-4499-bdbc-650137550b8a",
      "name": "获取服务",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -360,
        540
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1197995458,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit#gid=1197995458",
          "cachedResultName": "List Product"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nYii2KQDrKZNUPbLJ6r2ogNnGGZggJOJR6b6CGM3slY/edit?usp=drivesdk",
          "cachedResultName": "Leads To Sales"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "n0XqDbq8ykwdeS4k",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "573beee9-2030-496f-bb63-0a3384d4d07a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        -340
      ],
      "parameters": {
        "color": 4,
        "width": 720,
        "height": 380,
        "content": "## 获取潜在客户数据"
      },
      "typeVersion": 1
    },
    {
      "id": "20a1914f-6bf3-4093-9acb-98ae73cbb17a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        -340
      ],
      "parameters": {
        "color": 3,
        "width": 1380,
        "height": 540,
        "content": "## 公司调研"
      },
      "typeVersion": 1
    },
    {
      "id": "3fe97a6c-794b-4912-8a2e-bee3c69fd8f5",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        220
      ],
      "parameters": {
        "color": 5,
        "width": 1720,
        "height": 560,
        "content": "## 生成并发送潜在客户邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "74633aa8-d54a-4003-a06c-bd7f697b3950",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 940,
        "content": "## 总体描述与潜力"
      },
      "typeVersion": 1
    },
    {
      "id": "0d809625-af14-4e3f-9a43-dcebb36d3100",
      "name": "AI 销售助理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueRegularOutput",
      "position": [
        -180,
        540
      ],
      "parameters": {
        "text": "=You are an expert AI Sales Assistant, tasked with drafting a personalized and relevant email based on the provided data and additional research.\n\n1. PRIMARY CONTEXT (Based on Provided Data):\nSender's Company: Ainabler.com (IT consulting firm specializing in AI & Automation).\nSender's Name: Hanif R (Technical Sales).\nTarget Company: {{ $('If1').item.json.Perusahaan }}\nTarget Recipient: {{ $('If1').item.json.Nama }}\nRecipient's Position: {{ $('If1').item.json.Jabatan }}\nSales Stage: {{ $('getTemplate').item.json.Tahap }}\nMain Email Theme: {{ $('getTemplate').item.json.Tema }}\nKey Information: {{ $('Company Research1').item.json.output }}\nSample Message (For inspiration, not a rigid template): {{ $('getTemplate').item.json['Contoh message'] }}\nToday's Date: {{ $now }}\n\n2. ADDITIONAL RESEARCH TASK (Use Search Internet2):\nBefore writing the email, use Search Internet2 to find one or two recent facts/statistics (from 2024-2025) relevant to the recipient's position and their industry. The goal is to add a strong, data-driven 'hook' to make the email opening compelling.\nExample Research Direction: Based on the position '{{ $('If1').item.json.Jabatan }}', formulate a smart search query.\n- If the position is related to ESG, search for: \"ESG reporting challenges Indonesian banking 2025\"\n- If the position is related to Digital/Operations, search for: \"AI adoption statistics in Southeast Asia financial sector\"\n\n3. FINAL TASK: DRAFT THE EMAIL\nUse ALL the information above (Primary Context + Additional Research) to create one email draft.\n- Personalization: Mention the recipient's company name and position to show this is not a mass email.\n- Relevance: Connect the industry challenges (discovered from your research) with the solutions offered by Ainabler.com.\n- Value Proposition: Craft a natural and seamless offer based on our services and the target's business line. Adapt from the sample message, but do not be rigid.\n- Call to Action: Propose a brief discussion to explore possibilities.\n\n4. OUTPUT FORMAT (MANDATORY):\nYour final response MUST be a single, valid JSON object. Do not include any text, introductions, or closings outside of this JSON object.\n\n{\n  \"emailSubject\": \"A compelling and specific email subject\",\n  \"emailBody\": \"The complete, personalized, and relevant email body.\"\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "executeOnce": true,
      "typeVersion": 2
    }
  ],
  "pinData": {},
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "inputLink",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "inputLink": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "draftEmail": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "getService": {
      "main": [
        [
          {
            "node": "AI Sales Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "getTemplate": {
      "main": [
        [
          {
            "node": "getService",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "updateStatus": {
      "main": [
        [
          {
            "node": "getTemplate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Sales Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Company Research1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Company Research1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Internet1": {
      "ai_tool": [
        [
          {
            "node": "Company Research1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Search Internet2": {
      "ai_tool": [
        [
          {
            "node": "AI Sales Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Company Research1": {
      "main": [
        [
          {
            "node": "updateDescription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "updateDescription": {
      "main": [
        [
          {
            "node": "updateStatus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Sales Assistant": {
      "main": [
        [
          {
            "node": "draftEmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Sales Assistant",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户培育, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流