euno-slack-bot.json
{
"name": "Euno Slack Bot",
"nodes": [
{
"parameters": {
"trigger": ["app_mention", "message.im"],
"watchWorkspace": true,
"options": {}
},
"type": "n8n-nodes-base.slackTrigger",
"typeVersion": 1,
"position": [0, 0],
"id": "bed18f91-6c08-4f55-a781-db7040d98b43",
"name": "Slack Trigger",
"credentials": {
"slackApi": {
"id": "YOUR_SLACK_CREDENTIAL_ID",
"name": "Slack account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "8ab3a88a-d00b-44ea-bcec-6659e486af2a",
"name": "user_text",
"value": "={{$json.text || $json.blocks?.[0]?.elements?.[0]?.elements?.[1]?.text || ''}}",
"type": "string"
},
{
"id": "07458b06-3a87-42eb-afdf-5c3df4d3ed62",
"name": "thread_ts",
"value": "={{$json.thread_ts || $json.ts}}",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [250, 0],
"id": "06a06cb0-c5f0-40d6-9833-3c27b8c93c3f",
"name": "Edit Fields"
},
{
"parameters": {
"url": "https://slack.com/api/conversations.replies",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "slackApi",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "channel",
"value": "={{$('Slack Trigger').item.json.channel}}"
},
{
"name": "ts",
"value": "={{$('Slack Trigger').item.json.thread_ts || $('Slack Trigger').item.json.ts}}"
},
{
"name": "limit",
"value": "50"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [500, 0],
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Get Thread",
"credentials": {
"slackApi": {
"id": "YOUR_SLACK_CREDENTIAL_ID",
"name": "Slack account"
}
}
},
{
"parameters": {
"jsCode": "const threadData = $('Get Thread').first().json;\nconst slackMessages = threadData.messages || [];\nconst currentTs = $('Slack Trigger').first().json.ts;\nlet userText = $('Edit Fields').first().json.user_text || '';\n\nconst claudeMessages = [];\n\nfor (const msg of slackMessages) {\n if (msg.ts === currentTs) continue;\n const role = msg.bot_id ? 'assistant' : 'user';\n let text = (msg.text || '').replace(/\\n_Automated with this[\\s\\S]*$/m, '').trim();\n if (role === 'user') text = text.replace(/<@[A-Z0-9]+>\\s*/g, '').trim();\n if (!text) continue;\n claudeMessages.push({ role, content: text });\n}\n\nuserText = userText.replace(/<@[A-Z0-9]+>\\s*/g, '').trim();\nif (userText) claudeMessages.push({ role: 'user', content: userText });\nreturn [{ json: { messages: claudeMessages } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [750, 0],
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"name": "Format Messages"
},
{
"parameters": {
"method": "POST",
"url": "https://api.anthropic.com/v1/messages",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{ "name": "x-api-key", "value": "YOUR_ANTHROPIC_API_KEY" },
{ "name": "anthropic-version", "value": "2023-06-01" },
{ "name": "content-type", "value": "application/json" },
{ "name": "anthropic-beta", "value": "mcp-client-2025-11-20,prompt-caching-2024-07-31" }
]
},
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "={{ JSON.stringify({ model: \"claude-sonnet-4-6\", max_tokens: 8192, messages: $json.messages, mcp_servers: [{ type: \"url\", url: \"https://api.app.euno.ai/mcp?account_id=YOUR_ACCOUNT_ID&api_key=YOUR_EUNO_API_KEY\", name: \"euno\" }], tools: [{ type: \"mcp_toolset\", mcp_server_name: \"euno\", cache_control: { type: \"ephemeral\", ttl: \"1h\" } }] }) }}"
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [1000, 0],
"id": "8b752aed-d939-4466-b7c3-79cbe2840ba2",
"name": "HTTP Request"
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "={{$node[\"Slack Trigger\"].json[\"channel\"]}}",
"mode": "id"
},
"text": "={{$json.content?.filter(c => c.type === 'text')?.pop()?.text || 'Sorry, I could not generate a response.'}}",
"otherOptions": {
"thread_ts": {
"replyValues": {
"thread_ts": "={{$node[\"Edit Fields\"].json[\"thread_ts\"]}}"
}
}
}
},
"type": "n8n-nodes-base.slack",
"typeVersion": 2.4,
"position": [1250, 0],
"id": "00d961af-1e44-485a-acb4-d349b8a8fa49",
"name": "Send a message",
"credentials": {
"slackApi": {
"id": "YOUR_SLACK_CREDENTIAL_ID",
"name": "Slack account"
}
}
}
],
"connections": {
"Slack Trigger": { "main": [[{ "node": "Edit Fields", "type": "main", "index": 0 }]] },
"Edit Fields": { "main": [[{ "node": "Get Thread", "type": "main", "index": 0 }]] },
"Get Thread": { "main": [[{ "node": "Format Messages", "type": "main", "index": 0 }]] },
"Format Messages": { "main": [[{ "node": "HTTP Request", "type": "main", "index": 0 }]] },
"HTTP Request": { "main": [[{ "node": "Send a message", "type": "main", "index": 0 }]] }
},
"settings": { "executionOrder": "v1" },
"active": false,
"tags": []
}
Last updated