Question about Handling Initial Requests in n8n Chat Widget Integration

Got a question regarding embedding chats into websites.

I followed the steps as outlined here: @n8n/chat - npm

Everything works fine, but:

Each time the page loads, an initialization request to the webhook is made.

I have two issues:

  1. The initial request with the initialization results in a 500 error in my workflow because the AI agent doesn’t have a prompt. I tried adding an “IF” module to only trigger the AI when the sendMessage action is used, but it still throws a 500 error since no response data is provided.

    How do you handle these initial calls?

  2. Since I’ve implemented the widget on a page with high traffic, I don’t want the workflow runs to be consumed by these initialization calls.

    • Is there a way to disable this? Or can I configure it to initialize only when the user clicks on the chat widget?

I’m using the latest cloud version of n8n.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Simon_Hubs,

Welcome to the community :tada:

Can you share the configuration you are currently using? Are you also using a webhook node or a chat trigger node in your workflow?

Hey John,

Yes iam using the chat node trigger and use the hosted version of the chat

Which more configs do you need?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Hi @Simon_Hubs

We’re working on changing this behavior. Please have a look in another forum thread:

https://community.n8n.io/t/embeded-chat-costs-a-lot-even-when-not-used/59476/9

New version [email protected] got released which includes the GitHub PR 13132.