8
n8n 中文网amn8n.com

社交媒体分析与自动邮件生成

高级

这是一个AI, Marketing领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, EmailSend, HttpRequest 等节点,结合人工智能技术实现智能自动化。 社交媒体分析与自动邮件生成

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "a768bce6-ae26-464c-95fc-009edea4f94d",
      "name": "设置您公司的变量",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6a8063b6-1fd8-429a-9f13-b7512066c702",
              "name": "your_company_name",
              "type": "string",
              "value": "Pollup Data Services"
            },
            {
              "id": "3e6780d6-86d0-4353-aa17-8470a91f63a8",
              "name": "your_company_activity",
              "type": "string",
              "value": "Whether it’s automating recurring tasks, analysing data faster, or personalising customer interactions, we build bespoke AI agents to help your workforce work smarter."
            },
            {
              "id": "1b42f1b3-20ed-4278-952d-f28fe0f03fa3",
              "name": "your_email",
              "type": "string",
              "value": "thomas@pollup.net"
            },
            {
              "id": "7c109ba2-d855-49d5-8700-624b01a05bc1",
              "name": "your_name",
              "type": "string",
              "value": "Justin"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca729f8d-cab8-4221-addb-aa23813d80b4",
      "name": "获取领英帖子",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1300,
        0
      ],
      "parameters": {
        "url": "https://fresh-linkedin-profile-data.p.rapidapi.com/get-profile-posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "linkedin_url",
              "value": "={{ $('Google Sheets Trigger').item.json.linkedin_url }}"
            },
            {
              "name": "type",
              "value": "posts"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "fresh-linkedin-profile-data.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nhoVFnkO31mejJrI",
          "name": "RapidAPI Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b9559958-f8ac-4ab6-93c6-50eb04113808",
      "name": "获取推特 ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        680,
        0
      ],
      "parameters": {
        "url": "https://twitter-api47.p.rapidapi.com/v2/user/by-username",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "username",
              "value": "={{ $('Google Sheets Trigger').item.json.twitter_handler }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "twitter-api47.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nhoVFnkO31mejJrI",
          "name": "RapidAPI Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e85565f-ebfa-4568-9391-869961c5b3ed",
      "name": "获取推文",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        0
      ],
      "parameters": {
        "url": "https://twitter-api47.p.rapidapi.com/v2/user/tweets",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "userId",
              "value": "={{ $json.rest_id }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "twitter-api47.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nhoVFnkO31mejJrI",
          "name": "RapidAPI Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6e060b21-9eaf-49e6-9665-c051b3f2397e",
      "name": "提取并限制领英内容",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        0
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\noutput = []\nmax_posts = 10\nlet counter = 0\nfor (const item of $input.all()[0].json.data) {\n  let post = {\n    title: item.article_title,\n    text: item.text\n  }\n  output.push(post)\n  if(counter++ >= max_posts) break;\n}\n\nreturn {\"linkedIn posts\": output};"
      },
      "typeVersion": 2
    },
    {
      "id": "e65bc472-e7c6-43c5-8e84-fe8c4512e92f",
      "name": "提取并限制 X 内容",
      "type": "n8n-nodes-base.code",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\noutput = []\nmax_posts = 10\nlet counter = 0\nfor (const item of $input.all()[0].json.tweets) {\n  if(!item.content.hasOwnProperty('itemContent')) continue\n  let post = {\n    text: item.content.itemContent?.tweet_results?.result.legacy?.full_text\n  }\n  console.log(post)\n  output.push(post)\n  if(counter++ >= max_posts) break;\n}\n\nreturn {\"Twitter tweets\": output};"
      },
      "typeVersion": 2
    },
    {
      "id": "10f088a0-0479-428e-96cf-fe0df9b37877",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1740,
        200
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yepsCCAriRlCkICW",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9adfd648-8348-4a0a-8b9b-d54dc3b715bb",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1920,
        220
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"subject\": \"\",\n  \"cover_letter\": \"\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "af96003c-539d-4728-832c-4819d85bbbcc",
      "name": "根据匹配生成主题和求职信",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1720,
        0
      ],
      "parameters": {
        "text": "=## Me\n- My company name is:  {{ $('Set your company\\'s variables').item.json.your_company_name }}\n- My company's activity is: {{ $('Set your company\\'s variables').item.json.your_company_activity }}\n- My name is: {{ $('Set your company\\'s variables').item.json.your_name }}\n- My email is: {{ $('Set your company\\'s variables').item.json.your_email }}\n\n## My lead:\nHis name: {{ $('Google Sheets Trigger').item.json.name }}\n\n## What I want you to do\n- According to the info about me, and the linkedin posts an twitter post of a user given below, I want you to find a common activity that I could propose to this person and generate a cover letter about it\n- Return ONLY the cover letter and the subject as a json like this:\n{\n  \"subject\": \"\",\n  \"cover_letter\": \"\"\n}\n\nTHe cover letter should be in HTML format\n\n## The Linkedin Posts:\n{{ JSON.stringify($json[\"linkedIn posts\"])}}\n\n## THe Twitter posts:\n{{ JSON.stringify($('Exract and limit X').item.json['Twitter tweets']) }}\n",
        "messages": {
          "messageValues": [
            {
              "message": "You are a helpful Marketing assistant"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "6954285f-7ea5-4e3d-8be2-03051d716d03",
      "name": "发送求职信并抄送给我",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2080,
        0
      ],
      "parameters": {
        "html": "={{ $json.output.cover_letter }}",
        "options": {},
        "subject": "={{ $json.output.subject }}",
        "toEmail": "={{ $('Google Sheets Trigger').item.json.email }}, {{ $('Set your company\\'s variables').item.json.your_email }}",
        "fromEmail": "thomas@pollup.net"
      },
      "credentials": {
        "smtp": {
          "id": "yrsGGdbYvSB8u7sx",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "357477a8-98c3-48a5-8c88-965f90a4beb2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        -280
      ],
      "parameters": {
        "color": 4,
        "height": 480,
        "content": "## 在此处个性化设置"
      },
      "typeVersion": 1
    },
    {
      "id": "0c26383c-c8f1-44b1-995e-2c88118061bb",
      "name": "Google Sheets 触发器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -40,
        20
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "specifyRange"
            }
          }
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw/edit?usp=drivesdk",
          "cachedResultName": "Analyze social media of a lead"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "LBJHhfLqklwl9les",
          "name": "Google Sheets Trigger account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "923cca3d-69a9-4d26-80a3-e9062d42d8a8",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2280,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "done": "X",
            "linkedin_url": "={{ $('Google Sheets Trigger').item.json.linkedin_url }}"
          },
          "schema": [
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "twitter_handler",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "twitter_handler",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "done",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "done",
              "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": [
            "linkedin_url"
          ]
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IcvbbG_WScVNyutXhzqyE9NxdxNbY90Dd63R8Y1UrAw/edit?usp=drivesdk",
          "cachedResultName": "Analyze social media of a lead"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gdLmm513ROUyH6oU",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "6df02119-09db-4d87-b435-7753693b27aa",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        180,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3839b337-6c33-4907-ba75-8ef04cefc14c",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.done }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "executeOnce": false,
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "2edaa85e-ef69-490c-9835-cf8779cada6d",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 260,
        "height": 500,
        "content": "## 创建一个包含以下列的 Google 表格:"
      },
      "typeVersion": 1
    },
    {
      "id": "19210bba-1db1-4568-b34e-4e9de002b0eb",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -160
      ],
      "parameters": {
        "color": 5,
        "width": 340,
        "height": 300,
        "content": "## 您可以在此处修改提示"
      },
      "typeVersion": 1
    },
    {
      "id": "bebab4e5-35fa-49b7-bb85-a85231c44389",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        -280
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 480,
        "content": "## 调用 RapidAPI Twitter API 个人资料数据"
      },
      "typeVersion": 1
    },
    {
      "id": "42df4665-2d46-4020-938c-f082db6f09d0",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        -300
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 480,
        "content": "## 调用 RapidAPI 新鲜领英个人资料数据"
      },
      "typeVersion": 1
    },
    {
      "id": "4a14febd-bd82-428c-8c97-15f1ba724b02",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -620
      ],
      "parameters": {
        "width": 700,
        "height": 1180,
        "content": "## 社交媒体分析与自动化邮件生成"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Set your company's variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get tweets": {
      "main": [
        [
          {
            "node": "Exract and limit X",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        []
      ]
    },
    "Get twitter ID": {
      "main": [
        [
          {
            "node": "Get tweets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Subject and cover letter based on match",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Exract and limit X": {
      "main": [
        [
          {
            "node": "Get linkedin Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get linkedin Posts": {
      "main": [
        [
          {
            "node": "Extract and limit Linkedin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Subject and cover letter based on match",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract and limit Linkedin": {
      "main": [
        [
          {
            "node": "Generate Subject and cover letter based on match",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Cover letter and CC me": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set your company's variables": {
      "main": [
        [
          {
            "node": "Get twitter ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Subject and cover letter based on match": {
      "main": [
        [
          {
            "node": "Send Cover letter and CC me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能, 营销

需要付费吗?

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

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

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

作者
PollupAI

PollupAI

@zeerobug

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

外部链接
在 n8n.io 查看

分享此工作流