Webhook runs perfectly in test mode and does not work in production

I developed a workflow that runs perfectly when in text mode, when I activate and try to run in production it says there is an error I could not find it.
I am working on this for more than 20 hours and I could not fixed.
Plz any help would be highly appreciated
{
“parameters”: {
“url”: “={{ $json.body.data.content.media.url }}”,
“options”: {}
},
“id”: “55bfed94-ef41-479d-b024-f9bd4a1241c0”,
“name”: “HTTP Request1”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
980,
-240
],
“alwaysOutputData”: true,
“disabled”: true
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “04cb8e36-ce1b-47f9-9d61-cb777dfa398b”,
“leftValue”: “={{ $(‘Zap_Hook’).item.json.body.data.key.fromMe }}”,
“rightValue”: “false”,
“operator”: {
“type”: “boolean”,
“operation”: “false”,
“singleValue”: true
}
},
{
“id”: “a4d1dd7b-e90c-45bc-8165-38d0356d777f”,
“leftValue”: “={{ $(‘Zap_Hook’).item.json.body.data.key.fromMe }}”,
“rightValue”: “”,
“operator”: {
“type”: “boolean”,
“operation”: “true”,
“singleValue”: true
}
}
],
“combinator”: “and”
},
“options”: {}
},
“id”: “d8cb6b7a-5229-480c-8132-8bff7b808459”,
“name”: “chk_type”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
-260,
-280
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “b75c586c-df2b-4a29-b261-ab950a7dccdc”,
“name”: “chat”,
“value”: “={{ $json.body.data.message.conversation }}”,
“type”: “string”
},
{
“id”: “f62c16d8-ad78-44c4-9c04-5f2d0b786fe9”,
“name”: “sessionId”,
“value”: “={{ $json.body.data.key.remoteJid }}”,
“type”: “string”
},
{
“id”: “a5062916-65a0-45e0-a684-ab9ef711ddc3”,
“name”: “wid”,
“value”: “={{ $json.body.data.key.id }}”,
“type”: “string”
}
]
},
“includeOtherFields”: “={{ $json.body.data.contextInfo }}”,
“options”: {}
},
“id”: “7d1d8f59-3215-4a85-b92b-cee1486d1185”,
“name”: “capt_data”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-540,
-280
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “7683ed58-f391-4716-b55c-ea01bcadff09”,
“name”: “chat”,
“value”: “={{ $json.chat }}”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “f78f1e72-205a-4428-a5e6-ead063287ef6”,
“name”: “client_msg”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-320,
300
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “9dd1d234-40d9-4c66-8678-a811df006670”,
“name”: “=chatid1”,
“value”: “[email protected]”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “a149725a-ba74-461b-b4cf-397dc6f544f0”,
“name”: “Edit Fields1”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1040,
60
],
“disabled”: true
},
{
“parameters”: {
“content”: “Clean Redis”,
“height”: 302.71487533160337,
“width”: 736.6477661539801
},
“id”: “4da6d759-a2d4-4f66-8d25-a80e3f0336a3”,
“name”: “Sticky Note”,
“type”: “n8n-nodes-base.stickyNote”,
“typeVersion”: 1,
“position”: [
980,
-40
]
},
{
“parameters”: {
“content”: “Audio Treatment”,
“height”: 279.8804952785468,
“width”: 818.4709613440992
},
“id”: “ecc75d98-4de0-4fc4-a01b-c03fbd6e2e4d”,
“name”: “Sticky Note1”,
“type”: “n8n-nodes-base.stickyNote”,
“typeVersion”: 1,
“position”: [
920,
-320
]
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://evolutionwhatsappapi-evolutionwhatsapi.tzdlrc.easypanel.host/message/sendText/aflit_prod\n”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “apikey”,
“value”: “AC7162F0F782-4BD8-82D6-5420BDD9396D”
},
{
“name”: “accept”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “number”,
“value”: “={{ $(‘Zap_Hook’).item.json.body.data.key.remoteJid }}”
},
{
“name”: “text”,
“value”: “={{ $json.AI_answers }}”
},
{
“name”: “id”,
“value”: “={{ $(‘Zap_Hook’).item.json.body.data.key.id }}”
}
]
},
“options”: {
“redirect”: {
“redirect”: {}
}
}
},
“id”: “04f2644a-55f1-43b0-837e-6f918e62e833”,
“name”: “sends_answers”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
680,
240
],
“alwaysOutputData”: true,
“retryOnFail”: true
},
{
“parameters”: {
“amount”: 2
},
“id”: “907d7c5d-9043-4c9c-9cfa-fa7f34a1803f”,
“name”: “Wait1”,
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
500,
20
],
“webhookId”: “147191f2-23cb-43f4-bccb-bd50cdb95995”
},
{
“parameters”: {
“options”: {}
},
“id”: “ff36f772-b993-439a-b4d9-3576f5984b66”,
“name”: “Google Gemini Chat Model”,
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1,
“position”: [
-40,
200
],
“credentials”: {
“googlePalmApi”: {
“id”: “S0SG7PYpdWUXyde6”,
“name”: “Google Gemini(PaLM) Api account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $json.chat }}”
},
“id”: “4b11d03e-ce95-40ad-8aa4-ebd6bf9e6cce”,
“name”: “Redis Chat Memory”,
“type”: “@n8n/n8n-nodes-langchain.memoryRedisChat”,
“typeVersion”: 1.3,
“position”: [
80,
260
],
“credentials”: {
“redis”: {
“id”: “G0f6iz1dcHesDKs9”,
“name”: “Redis in Railway”
}
}
},
{
“parameters”: {
“rules”: {
“values”: [
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“leftValue”: “={{ $(‘Zap_Hook’).item.json.body.data.messageType }}”,
“rightValue”: “conversation”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “texto”
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“id”: “c42b80d7-89c4-4aa0-9e6c-f4f8804e9e81”,
“leftValue”: “={{ $(‘Zap_Hook’).item.json.body.data.messageType }}”,
“rightValue”: “audioMessage”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “Audio”
},
{
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 1
},
“conditions”: [
{
“id”: “b4175b79-323a-4870-8a90-20003d118287”,
“leftValue”: “={{ $(‘Zap_Hook’).item.json.body.data.messageType }}”,
“rightValue”: “extendedTextMessage”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
},
“renameOutput”: true,
“outputKey”: “extended”
}
]
},
“options”: {}
},
“id”: “670e057f-b3dd-40c9-908b-18889a3487bb”,
“name”: “Switch”,
“type”: “n8n-nodes-base.switch”,
“typeVersion”: 3,
“position”: [
-680,
340
]
},
{
“parameters”: {
“agent”: “conversationalAgent”,
“promptType”: “define”,
“text”: “=#mensagem do usuário\n{{ $json.chat }}”,
“options”: {
“systemMessage”: “Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nAll the answers should be generated in portuguese.”
}
},
“id”: “3b2cd8da-411d-4441-be92-d6049fe1daaf”,
“name”: “AI Agent2”,
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.6,
“position”: [
-60,
-20
],
“alwaysOutputData”: true,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “f444fb75-f740-4b7c-abe4-b74a61343f97”,
“name”: “AI_answers”,
“value”: “={{ $json.output }}”,
“type”: “string”
},
{
“id”: “f42d92a4-ac09-4eb8-91a5-fd6b171f42a3”,
“name”: “body.data.key.id”,
“value”: “={{ $(‘Zap_Hook’).item.json.body.data.key.id }}”,
“type”: “string”
},
{
“id”: “0b29c8cc-abe6-44fe-a4d8-8d63d5b2122c”,
“name”: “numerofone”,
“value”: “”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “e0b2c029-80be-43ec-8c16-acbaba124877”,
“name”: “AI-Answers”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
300,
140
]
},
{
“parameters”: {},
“id”: “35003d4a-5516-496c-9a2d-9d78bc844ae5”,
“name”: “No Operation, do nothing2”,
“type”: “n8n-nodes-base.noOp”,
“typeVersion”: 1,
“position”: [
900,
340
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “1734fdde-16a8-410f-bbfc-299f42a4ff06”,
“name”: “Answer”,
“value”: “Respondo somente a textos, tente novamente!”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “0274f59a-76f1-4857-8f67-b16bd3a7e966”,
“name”: “Edit Fields”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-300,
580
]
},
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “45eb37ea-dbaa-443b-929b-f0523bde0c05”,
“responseMode”: “lastNode”,
“responseData”: “allEntries”,
“options”: {}
},
“id”: “f1b85b7e-05ff-40e4-8dd1-a07b1a495b3c”,
“name”: “Zap_Hook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 2,
“position”: [
-820,
-280
],
“webhookId”: “45eb37ea-dbaa-443b-929b-f0523bde0c05”
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://evolutionwhatsappapi-evolutionwhatsapi.tzdlrc.easypanel.host/message/sendText/aflit_prod\n”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “apikey”,
“value”: “AC7162F0F782-4BD8-82D6-5420BDD9396D”
},
{
“name”: “accept”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “number”,
“value”: “={{ $(‘Zap_Hook’).item.json.body.data.key.remoteJid }}”
},
{
“name”: “text”,
“value”: “={{ $json.Answer }}”
},
{
“name”: “id”,
“value”: “={{ $(‘Zap_Hook’).item.json.body.data.key.id }}”
}
]
},
“options”: {
“redirect”: {
“redirect”: {}
}
}
},
“id”: “50225138-0d66-4941-8c9d-0ea403e87f87”,
“name”: “sends_answers1”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
20,
580
],
“alwaysOutputData”: true,
“retryOnFail”: true
}
],
“connections”: {
“chk_type”: {
“main”: [
null,
[
{
“node”: “Switch”,
“type”: “main”,
“index”: 0
}
]
]
},
“capt_data”: {
“main”: [
[
{
“node”: “chk_type”,
“type”: “main”,
“index”: 0
}
]
]
},
“client_msg”: {
“main”: [
[
{
“node”: “AI Agent2”,
“type”: “main”,
“index”: 0
}
]
]
},
“sends_answers”: {
“main”: [
[
{
“node”: “No Operation, do nothing2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait1”: {
“main”: [
[
{
“node”: “sends_answers”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent2”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Redis Chat Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent2”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Switch”: {
“main”: [
[
{
“node”: “client_msg”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “client_msg”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent2”: {
“main”: [
[
{
“node”: “AI-Answers”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI-Answers”: {
“main”: [
[
{
“node”: “Wait1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “sends_answers1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Zap_Hook”: {
“main”: [
[
{
“node”: “capt_data”,
“type”: “main”,
“index”: 0
}
]
]
},
“sends_answers1”: {
“main”: [
[
{
“node”: “No Operation, do nothing2”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}

Hi Alexandre,

I’ve been through the same issue — the webhook works fine in test mode, but fails in production, especially when the execution includes delays, AI nodes, or custom logic that takes time to process.

Here are a few things I’d suggest checking based on the workflow you shared:


:white_check_mark: 1. Webhook URL mismatch

In production mode, n8n generates a different webhook URL than in test mode. Make sure that:

  • The correct production webhook URL (https://your-n8n-host/webhook/...) is the one you’re calling externally (e.g., from your WhatsApp provider).
  • Test mode URLs are temporary and don’t persist after deploy/activate.

:white_check_mark: 2. Your webhook node is correctly positioned

In your case, the webhook node is correctly placed at the start of the flow, which is good. But make sure:

  • You are not calling the test URL from your external system.
  • You don’t have multiple active workflows with the same webhook path — it can cause conflicts.

:white_check_mark: 3. Delay and AI timing

You’re using a Wait node, Redis memory, and an AI agent (Gemini). This means:

  • The execution likely takes more than 1 minute.
  • Most external services (including webhook senders like WhatsApp APIs) have timeout limits (30–60s).
  • The webhook response is sent too late, or never arrives on the client side.

:bulb: One workaround I use:

  • Send a quick acknowledgment message first, like “Received, processing…” (using Respond to Webhook or a fast HTTP response).
  • Then complete the rest of the flow asynchronously (you already split things well with Wait, Redis, etc.).

:white_check_mark: 4. Debug by simplifying the workflow

You can:

  • Temporarily remove the AI nodes and test only the webhook + echo logic.
  • Use a Set node after Zap_Hook and return the incoming payload to see what’s reaching the workflow in production.

Let me know if you’d like me to review the full deployment context (n8n Cloud, Docker, Railway, etc.) — I’d be happy to help debug it step by step.

n8n attach workflow

You can attach like this, just hit paste once u click the code button,

Also have you tried to edit in editor from the executions tab? Maybe u can test the webhook data and pin it?