Chat Trigger works in n8n test but fails when called from website webhook URL

When I test the workflow directly inside n8n (using the built-in chat interface):

  • Asking: “how to enter sales order”

  • The agent answers correctly from FAQ

However, when I use the public webhook URL on my website, the chatbot fails to answer and instead returns the fallback message.

Please advice.

Here are the most likely things that could cause the issues and solutions:

1. Check Your Webhook Response Mode

The Webhook node needs to be configured correctly:

  • Open your Webhook node (the one that receives chat messages)

  • Set Respond to “When Last Node Finishes”

  • Make sure Response Mode is set to “Last Node”

2. Verify the Chat Message Format

Your website needs to send the message in the correct format. The webhook expects:

{
  "chatInput": "how to enter sales order",
  "sessionId": "unique-session-id"
}

Common issues:

  • Using message instead of chatInput

  • Not including a sessionId (required for conversation memory)

  • Sending as form data instead of JSON

3. Check CORS Settings

If calling from a website, add CORS headers to your Webhook node:

  • In the Webhook node, go to Options

  • Add Response Headers:

    • Access-Control-Allow-Origin: * (or your specific domain)

    • Access-Control-Allow-Methods: POST, OPTIONS

    • Access-Control-Allow-Headers: Content-Type

4. Test the Webhook Directly

Use this curl command to test if the webhook works correctly:

curl -X POST https://your-webhook-url \
  -H "Content-Type: application/json" \
  -d '{"chatInput": "how to enter sales order", "sessionId": "test123"}'

If this works but your website doesn’t, the issue is in how your website is calling the webhook.

5. Check Your Website’s Request

Make sure your website code sends the request properly:

fetch('https://your-webhook-url', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    chatInput: userMessage,
    sessionId: 'user-' + Date.now() // or use a persistent session ID
  })
})
1 Like

We need more information. Could you share your workflow?

Hi @techsupport Welcome!
Have you made sure that your workflow was correctly configured to handle that webhook request? And sharing your workflow would really help us get to know the issue more.

Too many AI replies these days.

this is my current workflow, can help identify what went wrong?

@techsupport Your workflow works fine on my end, and for the file upload workflow you are using webhook with i am assuming it is the one who gives errors have you tried using it in production?