LinkedIn自动消息路由与响应器(含请求检测)
这是一个Support, AI领域的自动化工作流,包含 52 个节点。主要使用 If, Set, Slack, Notion, Switch 等节点,结合人工智能技术实现智能自动化。 LinkedIn自动消息路由与响应器,具备请求检测功能
- •Slack Bot Token 或 Webhook URL
- •Notion API Key
- •HTTP Webhook 端点(n8n 会自动生成)
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (52)
{
"meta": {
"instanceId": "cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "5f71a0e6-d5ec-4712-9feb-2b10a1b0a3ea",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
0,
0
],
"webhookId": "12a0b328-1d39-44b4-b29d-9ac465cf134b",
"parameters": {
"path": "12a0b328-1d39-44b4-b29d-9ac465cf134b",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2
},
{
"id": "bd66537c-6fe5-4877-9127-3b78af08c499",
"name": "检查是否来自我",
"type": "n8n-nodes-base.if",
"position": [
440,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "711303bb-aef2-4cff-b4c7-c2a898e454ac",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.sender_id }}",
"rightValue": "OzJlgZHDXWi0PmxVdqnPOQ"
},
{
"id": "d115500d-8e14-4b8e-b0ed-4e26a895bb37",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.sender_id }}",
"rightValue": "9va5ul-NUYejvzb7ADJzuw"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e14aedab-47e9-4811-b991-ee0d00290c39",
"name": "响应,无操作",
"type": "n8n-nodes-base.noOp",
"position": [
700,
120
],
"parameters": {},
"typeVersion": 1
},
{
"id": "8adbb07e-4897-4421-b581-c963b754aa2b",
"name": "新消息",
"type": "n8n-nodes-base.noOp",
"position": [
680,
-140
],
"parameters": {},
"typeVersion": 1
},
{
"id": "39865ae2-a266-47ba-a6fd-c9b1f5d5a931",
"name": "全局变量",
"type": "n8n-nodes-base.set",
"position": [
220,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5483f235-49d0-404d-82dd-fd5688671044",
"name": "type",
"type": "string",
"value": "={{ $json.body.account_info.type }}"
},
{
"id": "d737da4a-cc6f-4dc5-a8b7-0fd60f6a45b5",
"name": "message",
"type": "string",
"value": "={{ $json.body.message }}"
},
{
"id": "924bd124-4ef1-4f41-8a3d-819d97f053e2",
"name": "message_id",
"type": "string",
"value": "={{ $json.body.message_id }}"
},
{
"id": "c05786b0-b2af-4d87-a111-aae969ce50e9",
"name": "chat_id",
"type": "string",
"value": "={{ $json.body.chat_id }}"
},
{
"id": "342fd20c-81be-42c7-aa85-a525fa9760fb",
"name": "sender",
"type": "string",
"value": "={{ $json.body.sender.attendee_name }}"
},
{
"id": "b40f55d7-928e-436f-90b7-b4048cd80423",
"name": "sender_profile",
"type": "string",
"value": "={{ $json.body.sender.attendee_profile_url }}"
},
{
"id": "efb12c87-42f5-4087-82b8-8dbda5aaf465",
"name": "sender_id",
"type": "string",
"value": "={{ $json.body.sender.attendee_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3c58401c-cb83-4d71-9469-7563d6ce9c16",
"name": "Slack 按钮按下",
"type": "n8n-nodes-base.webhook",
"position": [
0,
800
],
"webhookId": "e3182811-630a-4959-b91c-71d8c8093e1c",
"parameters": {
"path": "e3182811-630a-4959-b91c-71d8c8093e1c",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "b87d4806-423b-4656-bbd6-9d0808242cc4",
"name": "解析 Webhook",
"type": "n8n-nodes-base.set",
"position": [
480,
800
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "94e30709-cf7a-4131-bc89-dbe56f8f3b16",
"name": "body.payload",
"type": "object",
"value": "={{ $json.body.payload }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ee147347-1a88-4e96-9580-d08285e901c0",
"name": "验证 Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
240,
800
],
"parameters": {
"options": {
"responseCode": 200,
"responseHeaders": {
"entries": [
{
"name": "Content-type",
"value": "application/json"
}
]
}
},
"respondWith": "json",
"responseBody": "={\"challenge\":\"{{ $json.body.challenge }}\"}"
},
"typeVersion": 1
},
{
"id": "ac2cb5e1-394a-4a5c-a999-a56d315bc3ff",
"name": "检查是否已批准",
"type": "n8n-nodes-base.if",
"position": [
1140,
580
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cf275c3e-347d-4028-8209-682f52d540e3",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.payload.actions[0].value.action }}",
"rightValue": "approve"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "3812b521-2e15-4c24-9883-79ef04fc6cb3",
"name": "发送用户消息",
"type": "n8n-nodes-base.slack",
"position": [
4080,
-100
],
"webhookId": "e3624af3-3604-4d6a-b776-e3860b51b24e",
"parameters": {
"text": "=New LinkedIn Message from {{ $('Webhook').item.json.body.sender.attendee_name }}",
"user": {
"__rl": true,
"mode": "id",
"value": "U07G1JBR76W"
},
"select": "user",
"blocksUi": "={\n \"blocks\": [\n {\n \"type\": \"section\",\n \"block_id\": \"profile_card\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"👤*<{{ $('Webhook').item.json.body.sender.attendee_profile_url }}|{{ $('Webhook').item.json.body.sender.attendee_name }}>*\\n\\n💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].headline }}\\n\\n📍 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].location }}\\n👥 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].follower_count }} followers | 🔗 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].connections_count }} connections\"\n },\n \"accessory\": {\n \"type\": \"image\",\n \"image_url\": \"{{ $('Set all potential Inputs').item.json.linkedinprofile[0].profile_picture_url }}\",\n \"alt_text\": \"LinkedIn Profile Picture\"\n }\n },\n {\n \"type\": \"section\",\n \"block_id\": \"incoming_message\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*📩 <https://www.linkedin.com/messaging/thread/{{ $('Webhook').item.json.body.provider_chat_id }}/|New LinkedIn Message>:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\"\n }\n },\n {\n \"type\": \"input\",\n \"block_id\": \"ai_response\",\n \"element\": {\n \"type\": \"plain_text_input\",\n \"action_id\": \"response_input\",\n \"multiline\": true,\n \"initial_value\": \"{{ $('AI Agent').item.json.output.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\",\n \"placeholder\": {\n \"type\": \"plain_text\",\n \"text\": \"Edit the AI-generated response before approving...\"\n }\n },\n \"label\": {\n \"type\": \"plain_text\",\n \"text\": \"🤖 Suggested Reply\"\n }\n },\n {\n \"type\": \"actions\",\n \"block_id\": \"actions_block\",\n \"elements\": [\n {\n \"type\": \"button\",\n \"action_id\": \"approve_response\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"✅ Approve\"\n },\n \"style\": \"primary\",\n \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n },\n {\n \"type\": \"button\",\n \"action_id\": \"archive_message\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"🗃️ Archive\"\n },\n \"style\": \"danger\",\n \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n }\n ]\n }\n ]\n}\n",
"messageType": "block",
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "6xKmxBfKWNPnre2E",
"name": "Request Router"
}
},
"typeVersion": 2.3
},
{
"id": "7470b927-8a4d-4421-b6d3-cc55623d77dd",
"name": "发送组织消息",
"type": "n8n-nodes-base.slack",
"position": [
4080,
60
],
"webhookId": "9a621f5a-854e-4725-81c4-3ce075d87d96",
"parameters": {
"text": "=New LinkedIn Message from {{ $('Webhook').item.json.body.sender.attendee_name }}",
"user": {
"__rl": true,
"mode": "id",
"value": "U07G1JBR76W"
},
"select": "user",
"blocksUi": "={\n \"blocks\": [\n {\n \"type\": \"section\",\n \"block_id\": \"profile_card_org\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"🏢*<{{ $('Webhook').item.json.body.sender.attendee_profile_url }}|{{ $('Webhook').item.json.body.sender.attendee_name }}>*\\n\\n💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].headline }}\\n\\n📍 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].location }}\\n👥 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].follower_count }} followers | 🧑💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].employee_count }} employees\"\n },\n \"accessory\": {\n \"type\": \"image\",\n \"image_url\": \"{{ $('Set all potential Inputs').item.json.linkedinprofile[0].profile_picture_url }}\",\n \"alt_text\": \"Organization Profile Picture\"\n }\n },\n {\n \"type\": \"section\",\n \"block_id\": \"incoming_message\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*📩 New LinkedIn Message:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\"\n }\n },\n {\n \"type\": \"input\",\n \"block_id\": \"ai_response\",\n \"element\": {\n \"type\": \"plain_text_input\",\n \"action_id\": \"response_input\",\n \"multiline\": true,\n \"initial_value\": \"{{ $('AI Agent').item.json.output.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\",\n \"placeholder\": {\n \"type\": \"plain_text\",\n \"text\": \"Edit the AI-generated response before approving...\"\n }\n },\n \"label\": {\n \"type\": \"plain_text\",\n \"text\": \"🤖 Suggested Reply\"\n }\n },\n {\n \"type\": \"actions\",\n \"block_id\": \"actions_block\",\n \"elements\": [\n {\n \"type\": \"button\",\n \"action_id\": \"approve_response\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"✅ Approve\"\n },\n \"style\": \"primary\",\n \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n },\n {\n \"type\": \"button\",\n \"action_id\": \"archive_message\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"🗃️ Archive\"\n },\n \"style\": \"danger\",\n \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n }\n ]\n }\n ]\n}\n",
"messageType": "block",
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "6xKmxBfKWNPnre2E",
"name": "Request Router"
}
},
"typeVersion": 2.3
},
{
"id": "0c63c0e7-752d-4bd7-ab78-23a1ff4d70ae",
"name": "发送未找到消息",
"type": "n8n-nodes-base.slack",
"position": [
4080,
220
],
"webhookId": "64dddbb2-1bf6-4a5a-884b-057b82596ef1",
"parameters": {
"user": {
"__rl": true,
"mode": "id",
"value": "U07G1JBR76W"
},
"select": "user",
"blocksUi": "={\n \"blocks\": [\n {\n \"type\": \"section\",\n \"block_id\": \"incoming_message\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*New LinkedIn Message:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\"/g, '\\\\\"') }}\"\n }\n },\n {\n \"type\": \"input\",\n \"block_id\": \"ai_response\",\n \"element\": {\n \"type\": \"plain_text_input\",\n \"action_id\": \"response_input\",\n \"multiline\": true,\n \"initial_value\": \"{{ $json.output.output.replace(/\\n/g, '\\\\n').replace(/\"/g, '\\\\\"') }}\",\n \"placeholder\": {\n \"type\": \"plain_text\",\n \"text\": \"Edit the AI-generated response before approving...\"\n }\n },\n \"label\": {\n \"type\": \"plain_text\",\n \"text\": \"Suggested Reply\"\n }\n },\n {\n \"type\": \"actions\",\n \"block_id\": \"actions_block\",\n \"elements\": [\n {\n \"type\": \"button\",\n \"action_id\": \"approve_response\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"✅ Approve\"\n },\n \"style\": \"primary\",\n \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n },\n {\n \"type\": \"button\",\n \"action_id\": \"archive_message\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"🗃️ Archive\"\n },\n \"style\": \"danger\",\n \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n }\n ]\n }\n ]\n}\n",
"messageType": "block",
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "6xKmxBfKWNPnre2E",
"name": "Request Router"
}
},
"typeVersion": 2.3
},
{
"id": "fb29432d-7603-4b42-902f-7784459dd40d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-420
],
"parameters": {
"color": 7,
"width": 980,
"height": 720,
"content": ""
},
"typeVersion": 1
},
{
"id": "388d621c-7339-4d74-a2c4-4da9c41a441f",
"name": "便签11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
320
],
"parameters": {
"color": 7,
"width": 2097,
"height": 693,
"content": ""
},
"typeVersion": 1
},
{
"id": "13ed0034-df98-46a8-931c-4e87667e624c",
"name": "决定消息类型",
"type": "n8n-nodes-base.switch",
"position": [
3760,
-80
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "User",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4670af46-5774-4fec-8b12-a608aefa3d89",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set all potential Inputs').item.json.linkedinprofile[0].type }}",
"rightValue": "user"
}
]
},
"renameOutput": true
},
{
"outputKey": "Organization",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0a484630-343d-4b9a-9bf0-6ef5bd9b1b4b",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set all potential Inputs').item.json.linkedinprofile[0].type }}",
"rightValue": "organization"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "e4c36cc2-9ad1-4ceb-8698-05079c9c6509",
"name": "用户切换器",
"type": "n8n-nodes-base.switch",
"position": [
680,
800
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "angel",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "27c0a3cc-b768-4aba-bab0-19971fb2d38d",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.payload.user.id }}",
"rightValue": "U07G1JBR76W"
}
]
},
"renameOutput": true
},
{
"outputKey": "max",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b16b07b2-c77b-439f-9acb-e7799dceaa6b",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.payload.user.id }}",
"rightValue": "U035CE97JGM"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "f84186be-8ded-47c5-8bdb-9366c8be59fa",
"name": "隔离消息和有效载荷",
"type": "n8n-nodes-base.set",
"position": [
920,
580
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2a9278cb-3f2a-4f90-852a-3ca16b404c58",
"name": "message",
"type": "string",
"value": "={{ $json.body.payload.state.values.ai_response.response_input.value }}"
},
{
"id": "3c16c98d-a7db-42e9-aacd-9ede379b1f49",
"name": "body.payload.actions[0].value",
"type": "object",
"value": "={{ $json.body.payload.actions[0].value }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7dc03482-8c14-4494-a475-3f958a1fd445",
"name": "隔离有效载荷",
"type": "n8n-nodes-base.set",
"position": [
920,
820
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f334a7f4-4c85-466c-8278-3da5dd5a2486",
"name": "body",
"type": "object",
"value": "={{ $('Slack Button Press').item.json.body.payload }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "425b2b79-447d-4736-9edf-0033969d64b4",
"name": "发送 webhook 到同事工作流",
"type": "n8n-nodes-base.httpRequest",
"position": [
1140,
820
],
"parameters": {
"url": "https://n8n.cloud/webhook/89659f10-574e-s42c-530d-e7dd9158d177",
"method": "POST",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "4c36fc5c-75a5-4279-9555-13fdfa033510",
"name": "通过 Unipile 发送消息到 LinkedIn",
"type": "n8n-nodes-base.httpRequest",
"position": [
1380,
520
],
"parameters": {
"url": "=https://api9.unipile.com:13976/api/v1/chats/{{ $json.body.payload.actions[0].value.channel_id }}/messages",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "={{ $('Isolate Message and Payload').item.json.message }}"
}
]
},
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "VfYHlcsosNuUS2YD",
"name": "unipile angel"
}
},
"typeVersion": 4.2
},
{
"id": "bed8608b-b474-4472-87ad-1e3454799a81",
"name": "从 Slack 删除已批准消息",
"type": "n8n-nodes-base.slack",
"position": [
1680,
520
],
"webhookId": "08e7c073-569a-4400-aa60-80c7cddf8b03",
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "={{ $('User Switcher').item.json.body.payload.channel.id }}"
},
"operation": "delete",
"timestamp": "={{ $('User Switcher').item.json.body.payload.container.message_ts }}"
},
"credentials": {
"slackApi": {
"id": "6xKmxBfKWNPnre2E",
"name": "Request Router"
}
},
"typeVersion": 2.3
},
{
"id": "b79429a6-3b46-4898-a933-3b6ec77a1f97",
"name": "从 Slack 删除已拒绝消息",
"type": "n8n-nodes-base.slack",
"position": [
1680,
720
],
"webhookId": "70630dad-c2a5-4c40-aef3-070994ce4b83",
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "={{ $('User Switcher').item.json.body.payload.channel.id }}"
},
"operation": "delete",
"timestamp": "={{ $('User Switcher').item.json.body.payload.container.message_ts }}"
},
"credentials": {
"slackApi": {
"id": "6xKmxBfKWNPnre2E",
"name": "Request Router"
}
},
"typeVersion": 2.3
},
{
"id": "9a475e01-a250-44f2-8cc6-4ef60aedaa36",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
3220,
-80
],
"parameters": {
"text": "=Sender Name: {{ $('Isolate parent workflow data for AI').item.json.sender }}\nSender Message: {{ $('Isolate parent workflow data for AI').item.json.message }}\nMy Name: Your Name\n\nIf found, the linkedin profile will be below, pay close attention to the number of followers and connections: \n{{ $('Set all potential Inputs').item.json.linkedinprofile.toJsonString() }}",
"options": {
"systemMessage": "=You are an expert professional assistant designed to help generate smart, personalized responses to LinkedIn messages.\n\nYou will be provided with:\n1. The **incoming message** and name from a LinkedIn user.\n2. A **database of past requests and responses**. These are known message types and the preferred replies.\n3. Context about the assistant's voice and tone.\n\n### Your Objective:\n- First, scan the database for any message that closely matches the incoming LinkedIn message. If a match is found, use the **corresponding response** as a base — you may slightly tailor it if needed (e.g., change names or dates).\n- If no close match is found, generate a **new, thoughtful reply** based on the message content, tone guidelines, and best practices in business networking. If you do not have a direct link or URL to provide from the Request Database, do not reference a website or URL. Instead say a variation of let me get back to you on that and see what I can find. \n\n### Tone Guidelines:\n- Friendly, confident, and professional — but never robotic.\n- Lightly personalized. Use the sender’s name if available.\n- Avoid sounding like a sales pitch.\n- Keep replies concise and natural, like something you'd actually send on LinkedIn.\n\n### When generating a new message:\n- Acknowledge the sender’s message.\n- Add a relevant, helpful comment or question to continue the conversation.\n- Keep the tone warm and open-ended.\n\n### Output format:\nOnly output the message text that should be sent to the user. Do not explain your reasoning. If you do not have a direct link to provide, do not reference a website or URL. Instead say let me get back to you on that and see what I can find. \n\nLet’s begin.\nRequest Database:\n\n{{ $json.dbObject.join('\\n\\n----\\n\\n') }}\n\nWhen responding, use the following format:\n{\n\t\"output\": \"message response\",\n\t\"found\": true\n}\nFor output output the message response, for found output a boolean, true if an example is found in the Request Database, false if a response is not found. The output is going to slack so ensure you escape your outputs like new lines. "
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.9
},
{
"id": "53011c4c-b9aa-4b47-84c8-060e4b7a2db9",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
3340,
160
],
"parameters": {
"sessionKey": "={{ $('Isolate parent workflow data for AI').item.json.chatid }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "b5eb7520-c887-4a72-89d0-d616c24fdfca",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
3120,
180
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "QpFZ2EiM3WGl6Zr3",
"name": "Marketing OpenAI"
}
},
"typeVersion": 1.2
},
{
"id": "b405f410-4d76-43f9-b21c-b6cb363daa43",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
3500,
160
],
"parameters": {
"jsonSchemaExample": "{\n\t\"output\": \"message response\",\n\t\"found\": true\n}"
},
"typeVersion": 1.2
},
{
"id": "8ad9d20b-07a4-46f2-9dbb-5d3d8d502641",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
3020,
-400
],
"parameters": {
"color": 7,
"width": 668,
"height": 718,
"content": ""
},
"typeVersion": 1
},
{
"id": "8d593035-111a-45dc-93ea-950aad7b0ebb",
"name": "为 AI 隔离父工作流数据",
"type": "n8n-nodes-base.set",
"position": [
2260,
20
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "91a1191e-bac0-4b8b-b263-a03c63435470",
"name": "sender",
"type": "string",
"value": "={{ $('Global Variables').item.json.sender }}"
},
{
"id": "0f8c17c8-d598-4840-8b89-8dbdcd529231",
"name": "message",
"type": "string",
"value": "={{ $('Global Variables').item.json.message }}"
},
{
"id": "c9132b69-5e0e-4ccf-86bb-0e4cfa734860",
"name": "chatid",
"type": "string",
"value": "={{ $('Global Variables').item.json.chat_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "d267a541-a739-49b8-a2f6-b8afbb6cc837",
"name": "获取请求路由器目录数据库",
"type": "n8n-nodes-base.notion",
"position": [
2460,
20
],
"parameters": {
"options": {},
"resource": "databasePage",
"operation": "getAll",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "1da5b6e0-c94f-8086-80b6-eab8e340d60e",
"cachedResultUrl": "https://www.notion.so/1da5b6e0c94f808680b6eab8e340d60e",
"cachedResultName": "RequestRouterDB"
}
},
"credentials": {
"notionApi": {
"id": "2B3YIiD4FMsF9Rjn",
"name": "Angelbot Notion"
}
},
"typeVersion": 2.2
},
{
"id": "af762a13-5774-4608-a221-7860dce3f27c",
"name": "为 AI 上下文格式化数据库数据",
"type": "n8n-nodes-base.set",
"position": [
2660,
20
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c4ac8c33-a220-4c07-bc0d-dc7ba7cc068e",
"name": "dbObject",
"type": "string",
"value": "=Request Example: {{ $json.name }}\n--\nRequest Description: {{ $json.property_request_description }}\n--\nRequest Action: {{ $json.property_request_action }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "88da9528-2a4c-426a-bd27-8caa47bed3f5",
"name": "将数据库对象聚合为一个项目",
"type": "n8n-nodes-base.aggregate",
"position": [
2860,
20
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "dbObject"
}
]
}
},
"typeVersion": 1
},
{
"id": "204ce89b-9443-4ece-8385-cb3b59bd5a0b",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
2180,
-400
],
"parameters": {
"color": 7,
"width": 826,
"height": 700,
"content": ""
},
"typeVersion": 1
},
{
"id": "d4a894d6-334b-4abe-9d1a-0e449da46b6f",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
920,
-540
],
"parameters": {
"color": 7,
"width": 1246,
"height": 840,
"content": ")"
},
"typeVersion": 1
},
{
"id": "ec186db1-e7e8-480e-a94a-d4c1de5ee420",
"name": "从 Unipile 获取 LinkedIn 用户数据",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
980,
-140
],
"parameters": {
"url": "=https://api9.unipile.com:13976/api/v1/users/{{ $('Webhook').item.json.body.sender.attendee_provider_id }}",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "account_id",
"value": "-oWmWRkASjKGUZadYcjcyg"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "VfYHlcsosNuUS2YD",
"name": "unipile angel"
}
},
"typeVersion": 4.2
},
{
"id": "d3fb953a-f3cf-4005-934c-b091bb784d84",
"name": "设置来自 Unipile 的用户数据",
"type": "n8n-nodes-base.set",
"position": [
1240,
-280
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "aee91408-b68d-472e-8c3e-89260dd38c1c",
"name": "first_name",
"type": "string",
"value": "={{ $json.first_name }}"
},
{
"id": "57b3be6f-ba76-48c3-8f2e-1d9bb03d0dd5",
"name": "last_name",
"type": "string",
"value": "={{ $json.last_name }}"
},
{
"id": "75167f30-96d6-4442-9542-9d1b8e17fcb6",
"name": "headline",
"type": "string",
"value": "={{ $json.headline }}"
},
{
"id": "3e8bccc1-04a9-49f6-8053-eba22fe8d2f4",
"name": "websites",
"type": "array",
"value": "={{ $json.websites }}"
},
{
"id": "2e3dd2fe-5f71-4d19-bee8-085dd9bfc18c",
"name": "follower_count",
"type": "number",
"value": "={{ $json.follower_count }}"
},
{
"id": "ac5cc567-3c4f-481c-b229-9dc1e48d39fb",
"name": "connections_count",
"type": "number",
"value": "={{ $json.connections_count }}"
},
{
"id": "6bad07a6-4641-48cb-b436-fb735319865f",
"name": "location",
"type": "string",
"value": "={{ $json.location }}"
},
{
"id": "029fa351-f49f-4388-a59e-5719fcf8a506",
"name": "profile_picture_url",
"type": "string",
"value": "={{ $json.profile_picture_url }}"
},
{
"id": "2f96dca6-acee-41c0-83b5-00cd406d3301",
"name": "is_influencer",
"type": "boolean",
"value": "={{ $json.is_influencer }}"
},
{
"id": "4278e070-ce56-4993-b637-57ac60e83a49",
"name": "is_premium",
"type": "boolean",
"value": "={{ $json.is_premium }}"
},
{
"id": "b92c38f1-1423-4b7e-a807-320d13e0a944",
"name": "shared_connections_count",
"type": "number",
"value": "={{ $json.shared_connections_count }}"
},
{
"id": "96b24500-e6a4-444a-806c-0b61a1f00407",
"name": "type",
"type": "string",
"value": "user"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c6077ddb-362d-45f4-a497-2529348148ab",
"name": "分组到一个对象 - 用户",
"type": "n8n-nodes-base.aggregate",
"position": [
1420,
-280
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "linkedinprofile"
},
"typeVersion": 1
},
{
"id": "1eb09bf7-fb93-4c19-bc41-86330c7b33e6",
"name": "从 Unipile 获取 LinkedIn 组织数据",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
1240,
80
],
"parameters": {
"url": "=https://api9.unipile.com:13976/api/v1/linkedin/company/{{ $('Webhook').item.json.body.sender.attendee_provider_id }}",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "account_id",
"value": "-oWmWRkASjKGUZadYcjcyg"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "VfYHlcsosNuUS2YD",
"name": "unipile angel"
}
},
"typeVersion": 4.2
},
{
"id": "38f5ed6f-9302-4979-b964-c1d231a344b6",
"name": "设置来自 Unipile 的 LinkedIn 组织数据",
"type": "n8n-nodes-base.set",
"position": [
1520,
-80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "aee91408-b68d-472e-8c3e-89260dd38c1c",
"name": "first_name",
"type": "string",
"value": "={{ $json.name }}"
},
{
"id": "57b3be6f-ba76-48c3-8f2e-1d9bb03d0dd5",
"name": "last_name",
"type": "string",
"value": "="
},
{
"id": "75167f30-96d6-4442-9542-9d1b8e17fcb6",
"name": "headline",
"type": "string",
"value": "={{ $json.description }}"
},
{
"id": "3e8bccc1-04a9-49f6-8053-eba22fe8d2f4",
"name": "websites",
"type": "string",
"value": "={{ $json.website }}"
},
{
"id": "2e3dd2fe-5f71-4d19-bee8-085dd9bfc18c",
"name": "follower_count",
"type": "number",
"value": "={{ $json.followers_count }}"
},
{
"id": "ac5cc567-3c4f-481c-b229-9dc1e48d39fb",
"name": "employee_count",
"type": "number",
"value": "={{ $json.employee_count_range.from }}"
},
{
"id": "6bad07a6-4641-48cb-b436-fb735319865f",
"name": "location",
"type": "string",
"value": "={{ $json.locations[0].street.join(' ') }}, {{ $json.locations[0].city }} {{ $json.locations[0].area }}, {{ $json.locations[0].postalCode }} {{ $json.locations[0].country }}."
},
{
"id": "89035aa7-e7bb-46eb-9f4b-633e2c17478a",
"name": "hashtags",
"type": "array",
"value": "={{ $json.hashtags }}"
},
{
"id": "25b0abe6-aef7-4d6f-88ea-5fcbd3472089",
"name": "profile_picture_url",
"type": "string",
"value": "={{ $json.logo }}"
},
{
"id": "decf44b7-520e-4977-9df5-276c5117d8e4",
"name": "type",
"type": "string",
"value": "organization"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "45bd4b50-01e6-468b-815a-58073c137693",
"name": "分组到一个对象 - 组织",
"type": "n8n-nodes-base.aggregate",
"position": [
1720,
-80
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "linkedinprofile"
},
"typeVersion": 1
},
{
"id": "c97c50b6-b491-43cd-8eb6-e48b368c862e",
"name": "设置无法找到数据对象",
"type": "n8n-nodes-base.set",
"position": [
1640,
120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "438518ca-d55a-45d5-9210-0c53de7ae108",
"name": "linkedinprofile",
"type": "string",
"value": "Unable to find LinkedIn Data"
},
{
"id": "2d0595aa-bdd4-46e3-9f4d-e13e69c5a7a9",
"name": "type",
"type": "string",
"value": "none"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b42b967a-b127-458c-94b6-7a81052e6ba1",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"position": [
3700,
-400
],
"parameters": {
"color": 7,
"width": 857,
"height": 813,
"content": ""
},
"typeVersion": 1
},
{
"id": "48da88b3-beac-4c52-bf0c-460bc4d525fb",
"name": "设置所有潜在输入",
"type": "n8n-nodes-base.set",
"position": [
2020,
-80
],
"parameters": {
"options": {},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "7e091689-7905-4101-8dc9-0609b4f80233",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
-180
],
"parameters": {
"color": 3,
"height": 360,
"content": "#### 将我添加到 Unipile Webhook 仪表板"
},
"typeVersion": 1
},
{
"id": "97da9488-0e37-42c0-8dbf-912731fc5091",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
540
],
"parameters": {
"color": 3,
"height": 420,
"content": "#### 将我添加到您的 Slack 应用交互性和快捷方式"
},
"typeVersion": 1
},
{
"id": "c9be1dca-da24-4f18-b2a4-36f89b7520a1",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
-300
],
"parameters": {
"width": 180,
"height": 320,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "6e81a9bf-1c50-4366-9bae-be6241fc7875",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
-80
],
"parameters": {
"width": 180,
"height": 320,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "d8d5d5d1-6fe4-4f03-95cb-4d3cb6182f59",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2400,
-80
],
"parameters": {
"width": 220,
"height": 280,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "6a8202e9-e3c0-48db-b894-a009d801bddd",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
-180
],
"parameters": {
"width": 220,
"height": 340,
"content": "#### 使用您的 Unipile 用户 ID 更新"
},
"typeVersion": 1
},
{
"id": "36b271d3-53f6-4548-bf3f-8dea39e05b05",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
3060,
60
],
"parameters": {
"width": 220,
"height": 240,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "2391f630-e071-4720-81c8-7937452e0523",
"name": "便签13",
"type": "n8n-nodes-base.stickyNote",
"position": [
4020,
-160
],
"parameters": {
"width": 220,
"height": 560,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "c533f8ea-1391-4b2f-81ba-2caa8a919e3b",
"name": "便签14",
"type": "n8n-nodes-base.stickyNote",
"position": [
1320,
360
],
"parameters": {
"width": 220,
"height": 340,
"content": "#### 更新凭据"
},
"typeVersion": 1
},
{
"id": "6f0ef5cc-ef53-4a02-bdd9-5931c9ba8a0e",
"name": "便签15",
"type": "n8n-nodes-base.stickyNote",
"position": [
1620,
460
],
"parameters": {
"width": 220,
"height": 460,
"content": "#### 更新凭据"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Webhook": {
"main": [
[
{
"node": "Global Variables",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Decide on Message Type",
"type": "main",
"index": 0
}
]
]
},
"New Message": {
"main": [
[
{
"node": "Get Linkedin User Data from Unipile",
"type": "main",
"index": 0
}
]
]
},
"Parse Webhook": {
"main": [
[
{
"node": "User Switcher",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"User Switcher": {
"main": [
[
{
"node": "Isolate Message and Payload",
"type": "main",
"index": 0
}
],
[
{
"node": "Isolate Payload",
"type": "main",
"index": 0
}
]
]
},
"Verify Webhook": {
"main": [
[
{
"node": "Parse Webhook",
"type": "main",
"index": 0
}
]
]
},
"Isolate Payload": {
"main": [
[
{
"node": "Send webhook to Coworker Workflow",
"type": "main",
"index": 0
}
]
]
},
"Check if from me": {
"main": [
[
{
"node": "New Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Response, No action",
"type": "main",
"index": 0
}
]
]
},
"Global Variables": {
"main": [
[
{
"node": "Check if from me",
"type": "main",
"index": 0
}
]
]
},
"Check if approved": {
"main": [
[
{
"node": "Send Message to LinkedIn via Unipile",
"type": "main",
"index": 0
}
],
[
{
"node": "Delete Denied Message from Slack",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Slack Button Press": {
"main": [
[
{
"node": "Verify Webhook",
"type": "main",
"index": 0
}
]
]
},
"Decide on Message Type": {
"main": [
[
{
"node": "Send User Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Org Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Nothing Found Message",
"type": "main",
"index": 0
}
]
]
},
"Set all potential Inputs": {
"main": [
[
{
"node": "Isolate parent workflow data for AI",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Group in one object - Org": {
"main": [
[
{
"node": "Set all potential Inputs",
"type": "main",
"index": 0
}
]
]
},
"Group in one object - User": {
"main": [
[
{
"node": "Set all potential Inputs",
"type": "main",
"index": 0
}
]
]
},
"Set User Data from Unipile": {
"main": [
[
{
"node": "Group in one object - User",
"type": "main",
"index": 0
}
]
]
},
"Isolate Message and Payload": {
"main": [
[
{
"node": "Check if approved",
"type": "main",
"index": 0
}
]
]
},
"Format DB data for AI Context": {
"main": [
[
{
"node": "Aggregate DB objects into one item",
"type": "main",
"index": 0
}
]
]
},
"Set unable to find data object": {
"main": [
[
{
"node": "Set all potential Inputs",
"type": "main",
"index": 0
}
]
]
},
"Aggregate DB objects into one item": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Get Linkedin Org Data from Unipile": {
"main": [
[
{
"node": "Set Linkedin Org Data from Unipile",
"type": "main",
"index": 0
}
],
[
{
"node": "Set unable to find data object",
"type": "main",
"index": 0
}
]
]
},
"Set Linkedin Org Data from Unipile": {
"main": [
[
{
"node": "Group in one object - Org",
"type": "main",
"index": 0
}
]
]
},
"Get Linkedin User Data from Unipile": {
"main": [
[
{
"node": "Set User Data from Unipile",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Linkedin Org Data from Unipile",
"type": "main",
"index": 0
}
]
]
},
"Isolate parent workflow data for AI": {
"main": [
[
{
"node": "Get Request Router Directory Database",
"type": "main",
"index": 0
}
]
]
},
"Send Message to LinkedIn via Unipile": {
"main": [
[
{
"node": "Delete Approved Message from Slack",
"type": "main",
"index": 0
}
]
]
},
"Get Request Router Directory Database": {
"main": [
[
{
"node": "Format DB data for AI Context",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客户支持, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Angel Menendez
@djangelicAngel Menendez is a Staff Developer Advocate at n8n.io, specializing in low-code tools for cybersecurity workflows. From Puerto Rico, Angel's tech journey began by helping his father translate technical books. He later started a web development business and transitioned from a career as a flight attendant to cybersecurity engineering. His workflows have saved companies significant time. Outside work, Angel enjoys time with his two sons, riding electric bikes, reading, and exploring new places.
分享此工作流