Describe the problem/error/question
My Switch node is not sending data to my “Book Appointment” node.
What is the error message (if any)?
No actual error message. Based on the answer the n8n AI assistant provided, the issue is that the data I am sending does not match the condition I have set to send info to the “Book Appointment” node.
I have double checked the tool name I am using in VAPI to book appointments, and it is indeed spelled and formatted correctly: bookAppointment
Please share your workflow
I am new to using n8n, and am unsure how I am able to share a ‘mini canvas’ of my existing workflow.
I have made a short Loom recording instead. I hope this helps: Troubleshooting the Switch Node Issue in n8n 🤔 | Loom
Happy to provide more info if needed.
Information on your n8n setup
- Running n8n via (Docker, npm, n8n cloud, desktop app): Microsoft Edge
- Operating system: Windows 10
If you pin the data on the Webhook and share your workflow we can try to figure this out together.
Hi jabbson - thanks for the swift response.
I tried following the instructions you have linked to sharing my code, but I end up with an error message: “Token type ‘html_raw’ not supported by Markdown parser’“.
I noticed that there was a dropdown window that appears when I try to press the “</>” icon. Is there a specific option I should press before pasting the code?
Try switching to markdown first by clicking on this button
Thanks, jabbson. That works but it won’t let me post as the code exceeds the character limit:
I tried only including the nodes immediately before and after the switch node, but that didn’t seem to reduce the characters either.
I unpinned existing data - hopefully this works. And thanks for your patience so far.
I would really like to see the workflow with pinned data. If there isn’t much personal or sensitive info, try to publish the JSON on https://pastebin.com/ instead.
Hey @lnvelis yes, thank you for doing this.
I am looking at the workflow now and here is what I see:
the switch node is checking
{{ $('Webhook').item.json.body.message.toolCalls[0].function.name }}
in the pinned data of the webhook node we see the following:
so the value of the message.toolCalls[0].function.name is getOpenSlots
this is the reason why in the switch node, the first route is evaluated to true and the second route is evaluated to false.
I see. So, the issue is the VAPI AI agent is not sending a tool call with the function name ‘bookAppointment’. Is this correct?
This is strange, becase based on the transcript in VAPI, the tool is indeed being used by the agent, and it thinks it has successfully booked the appointment:
You might notice that In the transcript, it says “BookApointment” (with a capital ‘B’), but in the tools section of VAPI, I have labelled it as as ‘bookAppointment’.
Maybe that is the issue? The VAPI AI agent is sending data as “BookAppointment” even if it’s supposed to be ‘bookAppointment’?
However, this might be an unrelated issue, as I noticed that the in the input section of the Switch node, the ‘bookAppointment’ tool is indeed being referenced.
Just not sure why the Switch node is not picking this up. What do you think?
bookAppointment is mentioned in the call, but in a different place. Here is the path to it:
{{ $('Webhook').item.json.body.message.assistant.model.tools[0].function.name }}
Thanks, I’ve replaced the condition for the “Book Appointment” route with that path:
I just did another test call with VAPI, and once again it mentions that it has succesfully booked an appointment. However, when I track the actions being done in the workflow, the Switch is still not sending data towards the Book Appointment route - even with the updated path in place. Therefore, no calendar appointment is booked.
That makes sense - this is because switch by default stops after successfully matching the first rule. If you want all matching rules to be activated (as opposed to only the first one), enable this:
It worked!
I’ll keep using the workflow to make sure no other glitches appear. Thank you so much for your time jabbson!