Describe the problem/error/question
Wierd WF error on first trigger when adding the last Slack Send message node
t is the error message (if any)?
Please share your workflow
{
"nodes": [
{
"parameters": {
"trigger": [
"message"
],
"channelId": {
"__rl": true,
"value": "C0AFGAMF6SF",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.slackTrigger",
"typeVersion": 1,
"position": [
-656,
-80
],
"id": "7729dd90-0126-4548-9146-8841470f0c30",
"name": "Slack Trigger",
"webhookId": "c8e909e2-9f32-40c7-96b0-b06d88b42e9d",
"credentials": {
"slackApi": {
"id": "gQ4MKI4Uu89tcVAC",
"name": "Slack account"
}
}
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "C0AFGAMF6SF",
"mode": "id"
},
"text": "={{ $json.output }}",
"otherOptions": {}
},
"type": "n8n-nodes-base.slack",
"typeVersion": 2.4,
"position": [
-656,
248
],
"id": "46f0c39b-b2e8-48d8-aed4-6303f681fdb2",
"name": "Send a message",
"webhookId": "facdbfe8-f682-4b9a-9a52-7e1ce7577f85",
"credentials": {
"slackApi": {
"id": "gQ4MKI4Uu89tcVAC",
"name": "Slack account"
}
},
"disabled": true
},
{
"parameters": {
"model": "mistral-large-3:675b",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"typeVersion": 1,
"position": [
16,
144
],
"id": "ea9677f8-f438-4965-b5c6-9797f3fb9655",
"name": "Ollama Chat Model",
"credentials": {
"ollamaApi": {
"id": "1kJf2vO4nfUtMLBV",
"name": "Ollama account"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Slack Trigger').item.json.client_msg_id }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
144,
144
],
"id": "90328610-a185-4ada-8e79-2d5a5842d3ee",
"name": "Simple Memory"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "c10ae396-06c6-4c1f-a4ff-33b2c4d4ab01",
"name": "messageText",
"value": "={{$json.text}}",
"type": "string"
},
{
"id": "ce1510a8-3832-438c-aae4-25db9f1827e7",
"name": "=slackUserId",
"value": "={{ $json.user }}",
"type": "string"
},
{
"id": "58f97936-7455-41c0-bc0f-97b9eb64e00b",
"name": "channelId",
"value": "={{ $json.channel }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-208,
-80
],
"id": "6ddf698c-76ce-4e01-99cd-d5cfcc2628e6",
"name": "Extract Slack Fields"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "eae4faa1-68e5-4cd8-bb20-b591b96e38b9",
"name": "allowedServices",
"value": "Payments API, Auth API, Web Portal",
"type": "string"
},
{
"id": "f2610642-4f65-4a00-9dab-faf2c52a4c9b",
"name": "allowedEnvironments",
"value": "prod, staging, dev",
"type": "string"
},
{
"id": "b4ed74bf-e64d-4441-9836-0c1e6d09274e",
"name": "allowedPriorities",
"value": "Critical, High, Medium, Low",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-656,
472
],
"id": "9623fe8d-7b5f-4b6e-912c-8704ac106340",
"name": "Jira Metadata",
"disabled": true
},
{
"parameters": {
"promptType": "define",
"text": "=You are an IT Incident Classification Assistant.\n\nYour task is to analyze a Slack message and extract structured information.\n\nSchema:\n\n{\n \"summary\": string,\n \"description\": string,\n \"priority\": \"Low\" | \"Medium\" | \"High\",\n \"isSecurityIncident\": boolean,\n \"securityCategory\": \"Data Breach\" | \"Unauthorized Access\" | \"Malware\" | \"Phishing\" | \"None\",\n \"confidenceScore\": number\n}\n\nRules:\n\n1. Summary must be short (max 10 words).\n2. Description must clearly describe the issue.\n3. Priority rules:\n - Production outage or major business impact → High\n - Service degradation → Medium\n - Minor issue → Low\n4. If incident relates to:\n - Hacking\n - Unauthorized access\n - Data leak\n - Phishing\n - Malware\n - Credential compromise\n → set isSecurityIncident = true\n5. If not security-related → isSecurityIncident = false and securityCategory = \"None\"\n6. confidenceScore must be between 0 and 1.\n\n{{$json[\"messageText\"]}}\n\nReturn JSON only. Do NOT wrap the JSON in quotes or escape characters. \nOutput must be a JSON object, not a string.",
"hasOutputParser": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
72,
-80
],
"id": "64527472-d44e-431e-bdaf-ad6f0dffea5a",
"name": "AI Incident Classification",
"alwaysOutputData": false
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"summary\": \"string\",\n \"description\": \"string\",\n \"priority\": \"Low | Medium | High\",\n \"isSecurityIncident\": \"boolean\",\n \"securityCategory\": \"Data Breach | Unauthorized Access | Malware | Phishing | None\",\n \"confidenceScore\": \"number\"\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.3,
"position": [
272,
144
],
"id": "7e77205c-a6e8-4d8c-9e3b-75b78712c3d8",
"name": "Structured Output Parser"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "3ab23d04-f575-4b04-a1db-960ccb408f8a",
"leftValue": "isSecurityIncident ",
"rightValue": "true",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
480,
-80
],
"id": "624dffc0-1c2a-4a58-9ac2-c06032fc6cc4",
"name": "If"
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "{\n \"supportLevel\": \"Security Team\"\n}",
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
704,
-176
],
"id": "05291c7b-b808-41bf-917a-4759f1de11f3",
"name": "Routing to Security Team"
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "{\n \"supportLevel\": \"Service Desk L1\"\n}",
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
704,
16
],
"id": "6340d052-fd80-42c6-95a4-ac4fb5a61d36",
"name": "Routing to Service Desk"
},
{
"parameters": {
"jsCode": "// Get first input\nconst input = $input.first().json;\n\nconst requiredFields = {\n \"description\": \"text\",\n \"summary\": \"text\",\n \"priority\": [\"Low\", \"Medium\", \"High\"],\n \"isSecurityIncident\": [true, false],\n \"securityCategory\": [\"None\", \"Malware\", \"Data Breach\"],\n \"supportLevel\": [\"Service Desk L1\", \"Service Desk L2\", \"Specialist\"]\n};\n\nconst missingFields = [];\nconst output = input.output || {};\n\n// Threshold for confidence\nconst CONFIDENCE_THRESHOLD = 0.7;\n\n// Loop through fields\nfor (const field in requiredFields) {\n const validValues = requiredFields[field];\n const value = output.hasOwnProperty(field) ? output[field] : input[field];\n\n // Treat low confidence or vague placeholders as missing\n const vaguePlaceholders = [\"unspecified issue\", \"User reports unidentified issue\", \"None\"];\n\n if (value === undefined || value === null || value === \"\" \n || (typeof value === \"string\" && vaguePlaceholders.includes(value))\n || (field === \"description\" && output.confidenceScore < CONFIDENCE_THRESHOLD)\n ) {\n missingFields.push(field);\n } else if (Array.isArray(validValues) && !validValues.includes(value)) {\n missingFields.push(field);\n }\n}\n\n// Generate Slack message if any fields are missing\nlet slackMessage = \"\";\nif (missingFields.length > 0) {\n slackMessage = \"Hi! I’m working on creating your support request, but I need some additional info:\\n\";\n missingFields.forEach(field => {\n const example = Array.isArray(requiredFields[field]) ? requiredFields[field].join(\" / \") : requiredFields[field];\n slackMessage += `• \\`${field}\\`: please provide or clarify (e.g., ${example})\\n`;\n });\n slackMessage += \"\\nOnce I have these details, I can finalize your support object.\";\n}\n// Normalize quotes\nslackMessage = slackMessage.replace(/[\\u2018\\u2019\\u201C\\u201D]/g, \"'\");\n\n// Convert \\n to actual newlines (Slack accepts real newlines)\nslackMessage = slackMessage.replace(/\\\\n/g, \"\\n\");\n\n// Optional: trim any extra whitespace\nslackMessage = slackMessage.trim();\nreturn {\n json: {\n missingFields,\n slackMessage,\n originalData: input\n }\n};"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
928,
16
],
"id": "c972a500-5574-40ee-b4de-e5152f484386",
"name": "Code in JavaScript"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "97a5fb82-df07-4939-a1a1-559e4ebe7955",
"leftValue": "={{$json[\"missingFields\"].length}}",
"rightValue": 0,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
1152,
16
],
"id": "d9d2b69b-ed76-4b04-92fc-08706204fdcd",
"name": "If1"
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "C0AFGAMF6SF",
"mode": "id"
},
"messageType": "={{$json[\"slackMessage\"]}}",
"attachments": [],
"otherOptions": {
"thread_ts": {
"replyValues": {}
}
}
},
"type": "n8n-nodes-base.slack",
"typeVersion": 2.4,
"position": [
1392,
-48
],
"id": "e4efce6b-500e-4952-8985-df94f0ee433e",
"name": "Send a message1",
"webhookId": "4ee51e90-b4ba-407c-8bf4-9c10952b6b0c",
"credentials": {
"slackApi": {
"id": "gQ4MKI4Uu89tcVAC",
"name": "Slack account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "dac7c145-0a92-44cd-9a6a-e1eb6801ecc8",
"leftValue": "={{$json[\"subtype\"] === undefined ? \"true\" : \"false\"}}",
"rightValue": "true",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-432,
-80
],
"id": "02089c2f-e762-44e7-9a72-54005a5298a9",
"name": "If2"
}
],
"connections": {
"Slack Trigger": {
"main": [
[
{
"node": "If2",
"type": "main",
"index": 0
}
]
]
},
"Ollama Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Incident Classification",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Incident Classification",
"type": "ai_memory",
"index": 0
}
]
]
},
"Extract Slack Fields": {
"main": [
[
{
"node": "AI Incident Classification",
"type": "main",
"index": 0
}
]
]
},
"Jira Metadata": {
"main": [
[]
]
},
"AI Incident Classification": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Incident Classification",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Routing to Security Team",
"type": "main",
"index": 0
}
],
[
{
"node": "Routing to Service Desk",
"type": "main",
"index": 0
}
]
]
},
"Routing to Service Desk": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Send a message1",
"type": "main",
"index": 0
}
],
[]
]
},
"If2": {
"main": [
[
{
"node": "Extract Slack Fields",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "3dba50fea55b8a965fa42dc5ff83445861607f63463e6fd81c2553d59ecfeac2"
}
}(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
[
{
“missingFields”: [
“description”,
“summary”,
“securityCategory”
],
“slackMessage”: “Hi! I’m working on creating your support request, but I need some additional info:\n• description: please provide or clarify (e.g., text)\n• summary: please provide or clarify (e.g., text)\n• securityCategory: please provide or clarify (e.g., None / Malware / Data Breach)\n\nOnce I have these details, I can finalize your support object.”,
“originalData”: {
“output”: {
“confidenceScore”: 0.5,
“description”: “A user has reported experiencing an unspecified issue but has not provided details about the problem, its impact, or any potential security concerns.”,
“isSecurityIncident”: false,
“priority”: “Low”,
“securityCategory”: “None”,
“summary”: “User reports unidentified issue”
},
“supportLevel”: “Service Desk L1”
}
}
]
Information on your n8n setup
- n8n version: -
- Database (default: SQLite):-
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
- Operating system: WIndows
Context :
I am trying to use Slack as an input trigger to generate JSM incident in Jira.
For that as a start in my WF I have a Slack trigger defined as “New message in chanel”
When user identifie an issue, he can describe the issue in slack, then the IA agent is trying to parse the data to a well define Json structure for producing an incident in Jira.
In case the user infromation is incomplete, I need to send back to user some precision information from the last node Slack Send Message.
Problem :
If I disactivate the last node Slack Send Message, all is working fine and workflow trigs from start to end.
Case which cause trouble :
For an incomplete user instruction I need to send back a slack message through the Send Slack message node. When activating that node on same channel ID as the initial user request, then I get my workflow which crash immediately at the trigger level.
After asking chat GPT, its says that the possible reason is a self trigger loop as we reply to same channel as the trigger.
How to solve that use case then in order that it works nicely and in order to establish a normal conversion between Slack chanel and IA agent until all information is enough for producing final output ?
Thanks for help
regards