8
n8n 中文网amn8n.com

通话前抓取公司最新新闻

中级

这是一个Sales领域的自动化工作流,包含 12 个节点。主要使用 If, Set, Code, Gmail, HttpRequest 等节点。 通话前抓取公司最新新闻

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "3c58c896c9089c8fb4d7f2b069bf3119193f239a1f538829758e2f4d6b5f5b24"
  },
  "nodes": [
    {
      "id": "9aa9fa6c-5ccb-4f2b-b6a8-2b91f4a58355",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        420,
        680
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "apiKey",
              "stringValue": "32aa914c947342169c4998b6701a77e0"
            },
            {
              "name": "newsAge",
              "type": "numberValue",
              "numberValue": "10"
            },
            {
              "name": "maxArticles",
              "stringValue": "20"
            },
            {
              "name": "emails"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "6f471217-b69b-4f67-981d-c7c1e2d710b6",
      "name": "提取公司名称",
      "type": "n8n-nodes-base.set",
      "position": [
        1100,
        480
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "companyName",
              "stringValue": "={{ $json.summary.toLowerCase().replace('meeting with', '').replace('call with', '').trim() }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "9bb5adfa-5a36-453e-ad8d-59229ca2f1ab",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        320
      ],
      "parameters": {
        "color": 4,
        "width": 436,
        "height": 192,
        "content": "### 通话前的最新公司新闻"
      },
      "typeVersion": 1
    },
    {
      "id": "ddfa92e0-ff37-4733-9002-65fe21989d8a",
      "name": "每天早上7点",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        200,
        680
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "b71c3683-6077-41b4-ab23-66ee22f64532",
      "name": "筛选会议",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        680
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "bcfb06b1-d365-43a8-9802-869529baca98",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.summary.toLowerCase() }}",
              "rightValue": "call with"
            },
            {
              "id": "4ea43ccf-d586-4985-87db-fc1e9f734351",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.summary.toLowerCase() }}",
              "rightValue": "meeting with"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "34c4241e-e29a-4d9a-b8a8-130b9f19383f",
      "name": "获取最新新闻",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1300,
        480
      ],
      "parameters": {
        "url": "=https://newsapi.org/v2/everything?apiKey={{ $('Setup').first().json.apiKey }}&q={{ $json.companyName }}&from={{ DateTime.now().minus({ days: $('Setup').first().json.newsAge }).toFormat('yyyy-MM-dd') }}&sortBy=publishedAt&language=en&pageSize={{ $('Setup').first().json.maxArticles }}&searchIn=title",
        "options": {}
      },
      "typeVersion": 4.1
    },
    {
      "id": "51059db7-5fec-4287-bf3f-a6a4e76ac5a4",
      "name": "格式化邮件内容",
      "type": "n8n-nodes-base.code",
      "position": [
        1500,
        480
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "let html = `<table style=\"width: 100%\">`;\nhtml += '</table>';\n\nfor(article of $input.item.json.articles) {\n  console.log(article)\n  html += `\n    <tr>\n      <td style=\"display: flex; background-color: #f2f4f8; font-family: sans-serif; padding: 0.3em 0.5em\">\n        <div style=\"padding: 1em\">\n          <a style=\"display: block; margin-bottom: 10px; font-size: 1.2em\" href=\"${article.url}\">${article.title}</a>\n          <i>\n            ${article.description ? article.description : article.content}\n          </i>\n          <div style=\"margin-top: 1em\">\n            ${ article.source?.name ? '<b>Source:</b> ' + article.source?.name : '' }\n          </div>\n        </div>\n      </td>\n    </tr>\n  `\n}\nreturn { \"html\": html };"
      },
      "typeVersion": 2
    },
    {
      "id": "9b4351a8-edf9-49ef-829e-6998cb1eea2c",
      "name": "发送新闻",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1700,
        480
      ],
      "parameters": {
        "sendTo": "={{ $('Setup').first().json.emails }}",
        "message": "={{ $json.html }}",
        "options": {},
        "subject": "=Latest news for '{{ $('Extract company name').item.json.summary }}'"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "10",
          "name": "mrdosija@gmail.com"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "182504b0-3cf6-4afe-ba93-1d2bf7a02fa3",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        640
      ],
      "parameters": {
        "height": 511.499984507795,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "604bc73b-f805-40df-baa0-eb3de4c515f3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        660
      ],
      "parameters": {
        "width": 231.52514020446353,
        "height": 275.2500697149263,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "318b2bdc-712f-42a8-b224-8f0dc2c9c4e5",
      "name": "今日无会议",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1700,
        700
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "96b075cd-5c16-453e-93a6-348b22b704bb",
      "name": "获取今日会议",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        660,
        680
      ],
      "parameters": {
        "options": {
          "timeMax": "={{ $today.plus({ days: 1 }) }}",
          "timeMin": "={{ $today }}",
          "singleEvents": true
        },
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "milorad.filipovic19@gmail.com",
          "cachedResultName": "milorad.filipovic19@gmail.com"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "22",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Setup": {
      "main": [
        [
          {
            "node": "Get meetings for today",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter meetings": {
      "main": [
        [
          {
            "node": "Extract company name",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No meetings today",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get latest news": {
      "main": [
        [
          {
            "node": "Format for email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format for email": {
      "main": [
        [
          {
            "node": "Send news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every morning @ 7": {
      "main": [
        [
          {
            "node": "Setup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract company name": {
      "main": [
        [
          {
            "node": "Get latest news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get meetings for today": {
      "main": [
        [
          {
            "node": "Filter meetings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 销售

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类1
节点类型9
难度说明

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

作者
Milorad Filipović

Milorad Filipović

@n8n_milorad

Senior Frontend Engineer @ n8n

外部链接
在 n8n.io 查看

分享此工作流