Web Chat widget tool call question
# support
u
Hi VAPI support team, I have added a chat widget to my website. I am trying to figure out the correct way to call tools via n8n webhook. I have 2 tools, checking for calendar availability and booking appointment into the calendar. When I enable all of the server and client messages for the agent, every time I send a message to the chat agent, it sends a "chat.created" type in the webhook. I am trying to send the webhook only for the tools attached not each time I send a message. I noticed that it calls the tool but also with the "chat.created" type in the webhook. Does that mean there is not way to only call tools for the chat agents, the only way is to send a webhook request for each message, and then check if the tool was called. Would appriciate your help with this. Thank you.
v
You cannot prevent the "chat.created" webhook from being sent, but you can filter for tool calls in your webhook handler. Here’s a simple example in JavaScript:
Copy code
js
app.post('/webhook', (req, res) => {
  const eventType = req.body?.message?.type;
  if (eventType === 'tool-calls') {
    // Handle your calendar tool logic here
  }
  res.sendStatus(200); // Always respond to acknowledge receipt
});
Just process the
"tool-calls"
events and ignore
"chat.created"
events—they are informational and do not require a response. Source: [Vapi Server Events documentation](https://docs.vapi.ai/server-url/events)
m
Yeah this trips a lot of people up Vapi sends chat.created on every message since it treats webhooks like a full event stream, not just tool triggers. There’s no tools-only webhook yet, so you’ll have to filter inside n8n based on the event or tool name. Easiest way is just ignore chat.created unless there’s a tool call in the payload. Quick check — did you set your tools as server-only or both client + server? @User
u
Thanks for the information. Yes for the voice agent we have both the client and server messages fully enabled. The tool is a custom VAPI tool that the voice agent has access to and we see that it sends the tool inside the "chat.created" type in the n8n webhook
m
Got it, that makes sense since it’s firing on chat.created, your tool is basically triggering too early before the actual user message comes in. You’ll want to listen for message.created or tool.call, or just add a simple filter in n8n to ignore those initial/system events. Also worth checking your trigger logic so it’s not running on every chat start. I can help you clean this up properly. Happy to take this privately and walk you through it end-to-end 👍 @username420
s
Hi, thanks for reaching out.
Could you please provide us with the chat ID so we can investigate this further?