My Slack bot keeps looping back its reply up to 20 times in less than a min

I’ve built a Slack AI bot workflow using n8n that’s intended to act as an assistant to help manage my tasks, calendar, and communications. It works great in test mode. However, once deployed in production mode, I experience an issue where the bot continuously replies to itself in a loop—even without any new message input from a human user.

What I’ve tried:

  • I added an IF node to check if the message is coming from the bot’s own user ID and block it.
  • I tested expressions like {{$json["event"]["bot_id"]}}, {{$json["user"]}}, and even checked the full incoming payload, but I still get undefined, or the comparison fails.
  • I’ve also tried filtering based on user ID from the Slack Trigger, and confirmed the bot’s bot_id is correct (B08V6SCDG56), but the IF node expression fails or doesn’t block correctly.
  • The bot keeps posting the same “How can I help you?” message repeatedly, often 5–10 times without prompt.

What is the error message (if any)?

No specific error message — but the workflow behavior is incorrect: it loops and keeps replying over and over, making it unusable in production. Information on your n8n setup

n8n version: (cloud latest, May 2025)
Database: Default (SQLite)
Execution mode:** Default (own)
Running n8n via: n8n Cloud
Operating system: Windows 10 (for setup/testing)

{
“nodes”: [
{
“parameters”: {
“trigger”: [
“message”
],
“channelId”: {
“__rl”: true,
“value”: “C08V7112VEC”,
“mode”: “list”,
“cachedResultName”: “assistant-chatbot”
},
“options”: {}
},
“type”: “n8n-nodes-base.slackTrigger”,
“typeVersion”: 1,
“position”: [
-500,
480
],
“id”: “6aeb7059-c048-49f1-9ceb-8005f18d9f83”,
“name”: “Slack Trigger”,
“webhookId”: “15aca322-2d67-4b52-95ca-4b2e249a68de”,
“credentials”: {
“slackApi”: {
“id”: “xreszx1ggPRXMWna”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “0acf8188-6280-4533-8571-a54531ae67e6”,
“leftValue”: “={{$json["files"][0]["mimetype"]}}\n”,
“rightValue”: “audio”,
“operator”: {
“type”: “string”,
“operation”: “startsWith”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
-20,
480
],
“id”: “32a3ba90-9ffd-4b82-b596-3ead9e40d3b6”,
“name”: “If”
},
{
“parameters”: {
“resource”: “file”,
“operation”: “get”,
“fileId”: “={{ $json.files[0].id }}”
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
600,
380
],
“id”: “8092e5b6-b58b-4eb1-a405-eda45413d2b0”,
“name”: “Slack1”,
“webhookId”: “1fba9ed1-e186-4a69-bd67-8c81f6a307be”,
“credentials”: {
“slackApi”: {
“id”: “xreszx1ggPRXMWna”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“url”: “={{ $json.url_private }}”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Authorization\t”,
“value”: “Bearer xoxb-1081200626662-8992896477104-lJIabuib33CPDB0Yo7UMTseD”
}
]
},
“options”: {
“response”: {
“response”: {
“responseFormat”: “file”
}
}
}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
820,
380
],
“id”: “90d176a9-e730-490d-8f16-7cbea20f9566”,
“name”: “HTTP Request”
},
{
“parameters”: {
“resource”: “audio”,
“operation”: “transcribe”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.openAi”,
“typeVersion”: 1.8,
“position”: [
1040,
380
],
“id”: “b79747c1-af35-413c-9c7f-d71f35d76c88”,
“name”: “OpenAI”,
“credentials”: {
“openAiApi”: {
“id”: “JA0ROGyBQk2nCcLc”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “d0b1f6d2-67aa-4e35-b391-32a43a4bc47e”,
“name”: “text”,
“value”: “={{ $(‘Slack Trigger’).item.json.text }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1040,
580
],
“id”: “deb85d35-2883-496a-80bd-aafac320a957”,
“name”: “Edit Fields”
},
{
“parameters”: {
“model”: {
“__rl”: true,
“value”: “gpt-4.1”,
“mode”: “list”,
“cachedResultName”: “gpt-4.1”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
1160,
780
],
“id”: “952268f5-ebac-470e-8696-d73c3d9271d9”,
“name”: “OpenAI Chat Model”,
“credentials”: {
“openAiApi”: {
“id”: “JA0ROGyBQk2nCcLc”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ ‘my_test_session’ }}\n”,
“contextWindowLength”: 10
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
1360,
800
],
“id”: “202adf23-c60e-4bb8-bbe1-6a41b6e12f57”,
“name”: “Simple Memory”
},
{
“parameters”: {
“select”: “channel”,
“channelId”: {
“__rl”: true,
“value”: “C08V7112VEC”,
“mode”: “list”,
“cachedResultName”: “assistant-chatbot”
},
“text”: “={{ $json.output }}”,
“otherOptions”: {}
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
1940,
480
],
“id”: “71bcdb0f-ee26-4851-a8d6-b834c0e702f4”,
“name”: “Slack2”,
“webhookId”: “852f29a3-2862-4a2d-a8ed-46dfa117e808”,
“retryOnFail”: false,
“credentials”: {
“slackApi”: {
“id”: “xreszx1ggPRXMWna”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“url”: “=https://api.duckduckgo.com”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequestTool”,
“typeVersion”: 4.2,
“position”: [
1480,
800
],
“id”: “977d690e-c85c-43c3-bf76-577c54c3021a”,
“name”: “web search”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.text }}”,
“options”: {
“systemMessage”: “=##ROLE / OBJECTIVE\n\nYou are SUPER BOT, a highly capable, organized, and proactive AI Personal Assistant designed to help James stay on top of his life, work, and communication — all through natural conversations in Slack.\n\nYour job is to manage and orchestrate the activities between different agents and the formulate a friendly response back to the user in slack.\n\nYou should never try to write emails, create response, summarise, content, updates sheets, calender task etc.\n\nyour job is to call agent and tools in the correct sequence.\n\nThink carefully about the sequence of events. some tools might require you to first call another tool in other to pass it the correct information.\n\n\n\n\n## ADDITIONAL INFORMATION\n-You are talking to James\nThe current date and time is {{ $now }}\n\n## DO NOT KEEP LOOPING BACK YOUR REPLY TO THE SLACK OUTPUT. YOU MUST WAIT FOR JAMES RESPONSE BEFORE YOU SEND ANOTHER MESSAGE..\n\n## ALSO ENSURE NO OTHER TOOL OR SUB-WORKFLOW IS SENDIN REPLY YO SLACK OUTPUT.. CORDINATE AND ARRANGE THIS WELL.. NEVER!!\n\n\n\n## INSTRUCTIONS\nAlways respond with polished, well-formatted English.\n\nOne idea per paragraph.\n\nAdd a line break after each paragraph.\nUse polite, confident, and professional tone just like a real, elite executive assistant.\n\nAlways confirm actions clearly, only if you are confuse or details are not complete.\n\n\nIf a task is completed (email sent, meeting scheduled, message posted, etc.), confirm with a message like:\n\n\n :white_check_mark: Done. I’ve sent the email to Sarah regarding the meeting.\n\nNever guess email contents.\n\nAlways get the actual content using the Gmail Search or Message Read tool before summarizing or replying.\n\n\nAll input and output are done in Slack. Always keep James updated via Slack.\n\n#NEVER \nLoop back your replies multiple times or send replies when you are not triggered or asked.\n\nRespond to only new user messages. Do not reply again unless the user sends a new message or instruction.”\n\n\n\n\n TOOLS\nHere are the tools available to you:\n​:e_mail: Gmail Agent\n\n\n\n​:magnifying_glass_tilted_left: Web Search\ngoogle_search: Fetch real-time information from the web.\n\n\n​:globe_with_meridians: HTTP Requests\nhttp_request: Make requests to any webhook URL, APIs, or apps James connects to.\n\n\n​:speech_balloon: Slack\nsend_slack_message: Send message to a Slack channel or DM.\n\n\nread_slack_messages: Fetch messages from a channel or DM.\n\n\nreply_slack_message: Respond in a thread or main channel.\n\n\n​:date: Google Calendar\n\n\n\n\n\n”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 2,
“position”: [
1420,
480
],
“id”: “bdd3dccc-451f-47c7-a78b-b0d83b5eede9”,
“name”: “Supervisor Agent”
},
{
“parameters”: {
“description”: “Always, use this tool for any email / gmail related actions. like send email, reply email, get unread email.\n\nDO NOT TRY TO REPLY BACK TO SLACK OUTPUT. DON’T TRY IT. NO REPLY FROM YOU IS EXPECTED\n\n## INSTRUCTIONS\nAlways respond with polished, well-formatted English.\n\n\nOne idea per paragraph.\n\n\nAdd a line break after each paragraph.\n\n\nUse polite, confident, and professional tone — just like a real, elite executive assistant.\n\n\nALWAYS END EMAILS SEND WITH THESE SIGNATURE.\nMany Thanks,\n\t\n James Bellis\n Founder & CEO\n IG: @balancecoffee\n W: balancecoffee.co.uk\n\nFeatured as Best Healthy Coffee 2024 by The Independent :hot_beverage: :test_tube:\nFeatured as Best Mushroom Coffee for Coffee Connoisseurs by the Evening Standard :lion: :mushroom:\n\n”,
“workflowId”: {
“__rl”: true,
“value”: “rlb4JKbcE98Xg1te”,
“mode”: “list”,
“cachedResultName”: “Gmail Agent”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {},
“matchingColumns”: ,
“schema”: ,
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
}
},
“type”: “@n8n/n8n-nodes-langchain.toolWorkflow”,
“typeVersion”: 2.2,
“position”: [
1600,
800
],
“id”: “00ebc836-fe93-46af-88cd-f6f13f18c79c”,
“name”: “Gmail Agent”
},
{
“parameters”: {
“description”: “=You are a helpful assistant, Use this tool for any calender related actions. \n\nYou will use these tool to create, send check and update calender entry for james.\n\nDO NOT TRY TO REPLY BACK TO SLACK OUTPUT. DON’T TRY IT. NO REPLY FROM YOU IS EXPECTED\n\n## DATE & TIME\nAlways use human-friendly formats when referring to dates or times.\nExamples:\n✅ "Tomorrow at 2:00 PM"\n\n\n✅ "Monday, June 3 at 9:30 AM"\n\n\n✅ "This Friday evening"\n\n\nIf the user says something vague like "next Friday," clarify:\n❓Just to confirm — do you mean Friday this week (June 7) or next week (June 14)?\n\n\nwe are in the year 2025 ,so make sure your are deeply aware \nDO NOT use any other date other than the current date and time: {{ $now }}\n”,
“workflowId”: {
“__rl”: true,
“value”: “j0ctNUkuYsONY4Pr”,
“mode”: “list”,
“cachedResultName”: “Calender Agent”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {},
“matchingColumns”: ,
“schema”: ,
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
}
},
“type”: “@n8n/n8n-nodes-langchain.toolWorkflow”,
“typeVersion”: 2.2,
“position”: [
1760,
760
],
“id”: “8d43a50f-8a26-4843-9d8d-004d5ac1c2dc”,
“name”: “Calender Agent”
},
{
“parameters”: {},
“type”: “@n8n/n8n-nodes-langchain.toolCalculator”,
“typeVersion”: 1,
“position”: [
1940,
740
],
“id”: “cbfd95b0-c0a9-44e0-9dc9-512d17d9c3bd”,
“name”: “Calculator”
},
{
“parameters”: {
“description”: “use this tool to carry out any content writing action, research and also slack send dm or messages . DONOT TREY TO REPLY BACK TO SLACK OUTPUT. DON’T TRY IT.”,
“workflowId”: {
“__rl”: true,
“value”: “6r91r1IDDxkYw30G”,
“mode”: “list”,
“cachedResultName”: “Content Creator / Leads / slack messages”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {},
“matchingColumns”: ,
“schema”: ,
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
}
},
“type”: “@n8n/n8n-nodes-langchain.toolWorkflow”,
“typeVersion”: 2.2,
“position”: [
2140,
680
],
“id”: “24fee1cb-5748-4940-b711-11f81639a900”,
“name”: “Content Creator / Leads / slack messages”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “2dfb1447-45fb-4967-bb8a-b44199f7ce0b”,
“leftValue”: “={{$json["event"]["user"]}}\n\n”,
“rightValue”: “U08V6SCE132”,
“operator”: {
“type”: “string”,
“operation”: “notEquals”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
-280,
480
],
“id”: “3e8f22ae-9e9a-42d6-bc7c-4379bc0dde40”,
“name”: “If2”
}
],
“connections”: {
“Slack Trigger”: {
“main”: [
[
{
“node”: “If2”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [
[
{
“node”: “Slack1”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Slack1”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [
[
{
“node”: “OpenAI”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenAI”: {
“main”: [
[
{
“node”: “Supervisor Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “Supervisor Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenAI Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“web search”: {
“ai_tool”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Supervisor Agent”: {
“main”: [
[
{
“node”: “Slack2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Gmail Agent”: {
“ai_tool”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Calender Agent”: {
“ai_tool”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Calculator”: {
“ai_tool”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Content Creator / Leads / slack messages”: {
“ai_tool”: [
[
{
“node”: “Supervisor Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“If2”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “32021514e863ff2590cee4bc386491909b3c9c352db15b865b4f353b58078c88”
}
}

Hi there, why not instead of watching for any message posted in the channel, just use the trigger if you mention the bot, that way you dont have to do any checking and its more simplified and you wont have the problem where it’s replying to itself