8
n8n 中文网amn8n.com

Explorium MCP - Slack机器人

中级

这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 13 个节点。主要使用 If, Set, Code, Slack, HttpRequest 等节点。 使用Explorium MCP和Claude AI的Slack商业智能助手

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
  • Anthropic API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "nKluKJXe6qIz7tnR",
  "meta": {
    "instanceId": "0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77",
    "templateCredsSetupCompleted": true
  },
  "name": "Explorium MCP - Slack Bot",
  "tags": [],
  "nodes": [
    {
      "id": "2cdc96cf-c1b6-4177-ba58-6feae2c38bb5",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5472,
        -256
      ],
      "parameters": {
        "width": 640,
        "height": 880,
        "content": "## 1. 创建 Slack 应用"
      },
      "typeVersion": 1
    },
    {
      "id": "cbb39059-80ea-45b3-8cf3-65b39b7aed52",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6160,
        -256
      ],
      "parameters": {
        "width": 640,
        "height": 608,
        "content": "## 2. 配置 n8n"
      },
      "typeVersion": 1
    },
    {
      "id": "fdf690d4-4175-47a8-8a55-9b9051a5d9af",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5472,
        -560
      ],
      "parameters": {
        "width": 2912,
        "height": 256,
        "content": "# Slack 版 Explorium Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "68135d6e-9061-4e6b-a4fc-b0bacadff82c",
      "name": "Slack 触发器",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        6848,
        -160
      ],
      "webhookId": "5d3fa63f-ef0a-48f1-9550-d95e527fba61",
      "parameters": {
        "options": {
          "resolveIds": true
        },
        "trigger": [
          "app_mention"
        ],
        "watchWorkspace": true
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "82327159-f01d-433f-bd6a-6a66489eb568",
      "name": "检查是否为线程",
      "type": "n8n-nodes-base.if",
      "position": [
        7072,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "combineOperation": "any"
          },
          "conditions": [
            {
              "id": "condition1",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.thread_ts }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fa24f726-de97-46a5-91e9-da0ace8b2ef5",
      "name": "获取线程消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7296,
        -256
      ],
      "parameters": {
        "url": "https://slack.com/api/conversations.replies",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "channel",
              "value": "={{ $json.channel }}"
            },
            {
              "name": "ts",
              "value": "={{ $json.thread_ts }}"
            }
          ]
        },
        "nodeCredentialType": "slackApi"
      },
      "credentials": {},
      "typeVersion": 4.2
    },
    {
      "id": "4ab45f74-0e4d-4686-af3c-3b6865adb3d5",
      "name": "格式化线程上下文",
      "type": "n8n-nodes-base.code",
      "position": [
        7520,
        -256
      ],
      "parameters": {
        "jsCode": "// Get the original trigger data from the first item\nconst triggerData = $('Slack Trigger').first().json;\n\n// Get thread messages from Slack API response\nconst slackResponse = $input.first().json;\nconst messagesList = slackResponse.messages || [];\n\n// Build thread context from all messages\nlet threadContext = '';\nif (messagesList.length > 1) {\n  threadContext = messagesList\n    .map((msg, idx) => {\n      const text = msg.text || '';\n      const user = msg.user || 'Unknown';\n      const isBot = msg.bot_id ? ' (bot)' : '';\n      return `Message ${idx + 1} from ${user}${isBot}: ${text}`;\n    })\n    .join('\\n');\n}\n\n// Get current message text\nconst currentText = triggerData.text || (triggerData.blocks && triggerData.blocks[0] && triggerData.blocks[0].elements && triggerData.blocks[0].elements[0] && triggerData.blocks[0].elements[0].elements && triggerData.blocks[0].elements[0].elements[1] ? triggerData.blocks[0].elements[0].elements[1].text : '');\n\n// Combine context with current message\nconst finalText = messagesList.length > 1 \n  ? `Thread Context:\\n${threadContext}\\n\\nCurrent Message: ${currentText}`\n  : currentText;\n\nreturn {\n  channel: triggerData.channel || '',\n  ts: triggerData.ts || '',\n  thread_ts: triggerData.thread_ts || '',\n  type: triggerData.type || '',\n  text: finalText,\n  original_text: currentText,\n  is_bot: triggerData.bot_id ? true : false,\n  user: triggerData.user || '',\n  is_thread_continuation: triggerData.thread_ts ? true : false,\n  session_id: triggerData.thread_ts || triggerData.ts,\n  reaction: triggerData.reaction || '',\n  item_ts: triggerData.item ? triggerData.item.ts : '',\n  is_emoji: triggerData.blocks && triggerData.blocks[0] && triggerData.blocks[0].elements && triggerData.blocks[0].elements[0] && triggerData.blocks[0].elements[0].elements && triggerData.blocks[0].elements[0].elements[0] && triggerData.blocks[0].elements[0].elements[0].type === 'emoji' ? true : false,\n  has_thread_context: messagesList.length > 1\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "32e8b75b-844f-4cb7-9f1d-a1e9621a7b6c",
      "name": "无线程格式化",
      "type": "n8n-nodes-base.set",
      "position": [
        7520,
        -64
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2c1ec1ad-72f2-4bcd-bfef-dc12f49de48b",
              "name": "channel",
              "type": "string",
              "value": "={{ $json.channel || '' }}"
            },
            {
              "id": "af7e1d94-946c-4257-824e-a5d91a2b007a",
              "name": "ts",
              "type": "string",
              "value": "={{ $json.ts || '' }}"
            },
            {
              "id": "28583957-bddd-4bd2-b937-79b7554a7a65",
              "name": "thread_ts",
              "type": "string",
              "value": "={{ $json.thread_ts || '' }}"
            },
            {
              "id": "53179618-0ca1-43a2-a416-af8a39f792e0",
              "name": "type",
              "type": "string",
              "value": "={{ $json.type || '' }}"
            },
            {
              "id": "fbe15475-5924-41fa-a7b1-6017ae766a23",
              "name": "text",
              "type": "string",
              "value": "={{ $json.text || ($json.blocks && $json.blocks[0] && $json.blocks[0].elements && $json.blocks[0].elements[0] && $json.blocks[0].elements[0].elements && $json.blocks[0].elements[0].elements[1] ? $json.blocks[0].elements[0].elements[1].text : '') }}"
            },
            {
              "id": "49376ca5-079b-4993-9f15-6847734d9c5d",
              "name": "is_bot",
              "type": "boolean",
              "value": "={{ $json.bot_id ? true : false }}"
            },
            {
              "id": "b0ae1eed-7adf-49d2-b19d-0a1efdb5f435",
              "name": "user",
              "type": "string",
              "value": "={{ $json.user || '' }}"
            },
            {
              "id": "13fab869-b570-444d-903b-11d4b4f0ebe6",
              "name": "is_thread_continuation",
              "type": "boolean",
              "value": "={{ $json.thread_ts ? true : false }}"
            },
            {
              "id": "a148580e-6fe3-4689-be2f-7996c54f6118",
              "name": "session_id",
              "type": "string",
              "value": "={{ $json.thread_ts || $json.ts }}"
            },
            {
              "id": "311146c6-e6cf-492e-a4a9-09066e927879",
              "name": "reaction",
              "type": "string",
              "value": "={{ $json.reaction || '' }}"
            },
            {
              "id": "1b358df2-7062-4c7b-be7d-28bc69611322",
              "name": "item_ts",
              "type": "string",
              "value": "={{ $json.item ? $json.item.ts : '' }}"
            },
            {
              "id": "1e9d1f5a-4e0a-4ed8-8e23-660fe8b6a950",
              "name": "is_emoji",
              "type": "boolean",
              "value": "={{ $json.blocks && $json.blocks[0] && $json.blocks[0].elements && $json.blocks[0].elements[0] && $json.blocks[0].elements[0].elements && $json.blocks[0].elements[0].elements[0] && $json.blocks[0].elements[0].elements[0].type === 'emoji' ? true : false }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cc74fb30-c9ba-4837-8af3-15fc79c91c0b",
      "name": "Explorium Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        7800,
        -160
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=You are **Explorium Business Intelligence Agent**, created by Explorium.  \n\nAdvanced Explorium API agent with comprehensive business intelligence data through MCP.\n\n## Core Capabilities\n\n### Company Intelligence\n• Discovery: Search by industry, size, revenue, location, technology, growth metrics\n• Firmographics: Profiles, employee counts, revenue, industry classifications  \n• Technographics: Technology stacks, software usage, digital infrastructure\n• Financial Data: Revenue trends, funding rounds, investor information, financial metrics for public companies\n• Company Ratings: Employee satisfaction, company culture, work-life balance, management quality\n• Competitive Analysis: Market positioning, competitive landscape, strategic insights\n• Strategic Intelligence: Strategic focus areas, value propositions, target markets from SEC filings\n• Business Challenges: Risk analysis, security breaches, competitive pressures from public disclosures\n• Events: Funding, product launches, partnerships, office changes, business developments\n• Workforce Analytics: Department composition, hiring trends, organizational structure\n• Social Intelligence: LinkedIn posts, website changes, digital presence\n• Website Intelligence: Keyword searches, content analysis, website changes tracking\n• Market Statistics: Aggregated industry insights, geographic distribution, revenue analysis\n\n### Prospect Intelligence  \n• Discovery: Find executives, decision-makers by role, company, industry, experience\n• Contact Enrichment: Professional/personal emails, phone numbers, verification\n• Profiles: Work history, education, skills, career progression\n• Role Intelligence: Current positions, job levels, departments, reporting structure\n• Social Activity: LinkedIn posts, engagement metrics, professional content\n• Career Events: Job changes, promotions, role transitions, anniversaries\n\n### Analytics & Communication\n• Market Research: Industry trends, competitive positioning, landscape analysis\n• Investment Intelligence: Funding rounds, investor networks, financial milestones\n• Growth Tracking: Company expansion, headcount changes, business evolution\n• Personalized Outreach: Targeted messaging using real-time business intelligence\n• Trigger-Based Communication: Messages based on events, role changes, milestones\n• Smart Autocomplete: Intelligent suggestions for industries, technologies, job titles, locations\n• Web Search: General web search capabilities for additional context and research\n\n## Response Guidelines\n\n### Workflow\n1. **Discovery**: Search companies/prospects using filters\n2. **Intelligence**: Enrich with detailed data\n3. **Analysis**: Analyze trends, patterns, competitive insights  \n4. **Action**: Generate personalized messages, recommendations, strategic insights\n\n### Communication\n• Always mention using **\"Explorium API\"** (never internal function names)\n• **Keep responses concise and focused** - provide essential information without unnecessary elaboration\n• State total matches found and suggest relevant enrichments\n• When responding to thread conversations, consider the full context provided\n• Format your responses for slack, the output will be post in slack so it should looks good and well formated there. use the slack guidelines below and not md format (for example for headline use *Some Header* and not **Some Header**):\n\nSlack Guidelines:\n*bold text* - makes text bold\n_italic text_ - makes text italic\n~strikethrough~ - strikes through text\n`code` - inline code formatting\n```code block``` - multi-line code block\n\n- Use asterisk + space for bullet points\n- Like this\n\n1. Numbered lists\n2. Work like this\n\n<https://example.com|Link text> - creates a clickable link\n<@U123ABC> - mentions a user (using their user ID)\n<#C123ABC|channel-name> - links to a channel\n\n> Quoted text\n> Continues on next line\n\n--- \n\nCreates a horizontal line\n```\n\n### Error Handling\n• Tool errors/no data: respond **\"An error occurred.\"**\n• Invalid queries: guide toward valid parameters\n• Off-topic requests: redirect to business intelligence use cases\n\n## Off-Topic Handling\nFor non-business intelligence requests:\n\n> I'm the Explorium Business Intelligence Agent, designed to demonstrate our comprehensive company and prospect intelligence platform.  \n>   \n> **Example capabilities:**  \n> • Find SaaS firms in New York with 50‑200 employees  \n> • Show Microsoft's technology stack  \n> • Get marketing‑director contacts at healthcare companies  \n> • Compare funding rounds of fintech startups\n>   \n> What business intelligence would you like to explore?\n\n## Technical Notes\n• Use autocomplete for industries, technologies, job titles, company categories before filtering\n• Combine multiple criteria for precise targeting and comprehensive results\n• Prioritize recent data and real-time insights over historical data\n• Maintain conversation context for follow-up enrichments and related queries\n• Use web search for general information, news, and context not available in business intelligence data\n• Leverage aggregated statistics tools for market-level insights and trends\n• Provide alternative search strategies when initial queries fail\n• When using fetch_prospects or fetch_businesses tools limit the results (size and page_size) to 5 results\n• Thread context is automatically provided when responding to messages in a thread",
          "returnIntermediateSteps": false
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "533e4626-aeb0-42e1-a55c-452229bdcfcc",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        7744,
        64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-haiku-4-5-20251001",
          "cachedResultName": "Claude Haiku 4.5"
        },
        "options": {}
      },
      "credentials": {},
      "typeVersion": 1.3
    },
    {
      "id": "2504c14b-2d58-467d-ac40-d4a1317b8a7a",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        7872,
        64
      ],
      "parameters": {
        "sessionKey": "={{ $json.session_id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "95bcd5f2-ffd7-4925-95ae-7fc5f9e32937",
      "name": "Explorium MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        8000,
        64
      ],
      "parameters": {
        "options": {},
        "endpointUrl": "https://mcp.explorium.ai/mcp",
        "authentication": "headerAuth"
      },
      "credentials": {},
      "typeVersion": 1.2
    },
    {
      "id": "cb0f9fbf-1150-4a70-be4d-2d459376e52c",
      "name": "发送消息",
      "type": "n8n-nodes-base.slack",
      "position": [
        8208,
        -160
      ],
      "webhookId": "a840217b-6faa-474a-9cc5-21bcbb9c8db8",
      "parameters": {
        "text": "={{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $item(\"0\").$node[\"Slack Trigger\"].json[\"channel\"] }}"
        },
        "otherOptions": {
          "thread_ts": {
            "replyValues": {
              "thread_ts": "={{ $item(\"0\").$node[\"Slack Trigger\"].json[\"thread_ts\"] || $item(\"0\").$node[\"Slack Trigger\"].json[\"ts\"] }}"
            }
          },
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {},
      "typeVersion": 2.3
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "34a61d7c-9ded-4af2-b24d-b462106cfe11",
  "connections": {
    "Explorium MCP": {
      "ai_tool": [
        [
          {
            "node": "Explorium Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Explorium Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "Check If Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Thread": {
      "main": [
        [
          {
            "node": "Fetch Thread Messages",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Without Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Explorium Agent": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Explorium Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Thread Messages": {
      "main": [
        [
          {
            "node": "Format Thread Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Thread Context": {
      "main": [
        [
          {
            "node": "Explorium Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Without Thread": {
      "main": [
        [
          {
            "node": "Explorium Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客服机器人, AI 聊天机器人

需要付费吗?

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

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

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

作者
explorium

explorium

@explorium

Explorium empowers businesses to build high-performance GTM agents with specialized data infrastructure. Our seamless API integrations and high-quality data drive faster agent development and better results. With years of experience and robust data sets, we deliver context-aware solutions, helping AI agents achieve human-level support. Explorium is the essential data partner for teams building agent-driven technologies.

外部链接
在 n8n.io 查看

分享此工作流