jeromec8194
04/25/2025, 2:57 PMshowImage(3)
This is purely a UI requirement, so no need for a webhook here.
I was planning to use the on("message") event handler, and handle tool-calls messages in there.
I've set up a tool, and added an instruction "Invoke `showImage`" in my prompt.
So far this is ...not working, 🙂 And I'm wondering what the issue is: could it be because I haven't configured a webhook in my tool setup that my tool is never invoked?
More generally, is this the right approach?Vapi Support Bot
04/25/2025, 2:59 PMon("message")
event handler to listen for tool calls:
javascript
vapi.on("message", (message) => {
if (message.type === "tool-calls") {
// Handle the tool call
if (message.toolCalls[0].name === "showImage") {
const imageId = message.toolCalls[0].parameters.id;
// Update UI to show image
}
}
});
Make sure your tool is configured without a serverUrl to ensure it's processed client-side.
Sources:
- [Discord message about client-side tool calls](https://discord.com/channels/1211482211119796234/1342336047589359618)
- [Discord message about on("message") event handler](https://discord.com/channels/1211482211119796234/1260258706667343892)Kings_big💫
04/25/2025, 7:23 PMjeromec8194
04/26/2025, 7:59 AMKings_big💫
04/26/2025, 8:07 AMjeromec8194
04/28/2025, 2:01 PMKings_big💫
04/28/2025, 3:44 PMKings_big💫
04/28/2025, 3:45 PMjeromec8194
04/29/2025, 3:17 PMKings_big💫
04/29/2025, 3:37 PMRaphael
05/02/2025, 1:01 PMKings_big💫
05/02/2025, 1:06 PM