https://retellai.com/?utm_source=discord&utm_medium=seo logo
j
@AI Evy Hi, new here. I've been using VAPI for a while but was advised to give Retell a try and really like it so far. However I'm really struggling getting a custom function to run. Which is basically just a zapier webhook. I've got an agent which speaks with my customers, and when they want to be transferred a transfer agent takes over the call. They take some details and at this point a custom function is supposed to call a zapier webhook, but it never does. I really don't know how to make this happen. I've tried adding it to the prompt. I'm currently using a simple Rigid Mode so thought as long as it follows the pathway it would work but it doesn't. https://cdn.discordapp.com/attachments/1302816169367044149/1486464458720149736/image.png?ex=69c59968&is=69c447e8&hm=a55434b8ef74312b20ce8b1dba70acdbc8174e555546fcd513a11a8bace03caa&
a
Thanks for tagging me @James. I'll look through relevant sources and get back to you shortly.
### Answer Welcome to Retell! Based on the sources, there are several common reasons why custom functions don't execute in conversation flows, especially when using agent transfers. Key Issues to Check: 1. Separate the Custom Function into Its Own State When you add a tool as "Optional" in a state, the LLM decides whether to call it based on conversation context. [(1) ]() If your custom function and other tools (like end_call or transfer_call) are in the same state, the LLM might prioritize those over your webhook. [(2) ]() Solution: Create a dedicated state for your custom function that executes before any transfer or end-call actions. 2. Improve Your Prompt Instructions Simply stating the function should execute isn't sufficient. You need to explicitly describe when the function should be invoked. [(3) ]() For example:
Copy code
When user provided the city name, please get the weather for that city by calling the `get_weather` function.
3. Configure Speech Behavior In your custom function configuration, ensure you've properly set "Speak During Execution" and "Speak After Execution" settings. [(1) ]() These control whether the agent speaks when the function is called and after it completes. 4. Verify Your JSON Schema Make sure your custom function has a valid JSON schema for parameters. If you're passing arguments, avoid using reserved keywords like "id" - try renaming to something like "user_id" instead. [(4) ]() 5. Check Your Webhook URL Ensure there's no trailing slash in your webhook URL, as this can cause issues with the HTTP method being sent incorrectly. [(2) ]() Recommended Next Steps: 1. Create a separate conversation node specifically for your custom function before the transfer 2. Update your node instruction to explicitly state when to call the webhook 3. Verify your JSON parameter schema is valid 4. Check that your Zapier webhook URL doesn't have a trailing slash If these don't resolve the issue, check your call logs in the Retell dashboard to see if the function is being invoked but failing, or if it's not being called at all.
​ To learn more, see the sources I considered: [[1] Node Functions](https://docs.retellai.com/build/conversation-flow/conversation-node-functions) [[2] Custom function not executing despite being configured as tool in state](https://community.retellai.com/t/custom-function-not-executing-despite-being-configured-as-tool-in-state/705) [[3] Function Calling Overview](https://docs.retellai.com/build/single-multi-prompt/function-calling) [[4] Falla al pasar argumentos a una Custom Function](https://discord.com/channels/1186424376300679209/1332455959372628141) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
o
When are you available to hop on a zoom call so we can fix this together... And also, for tool webhook, you can't make use of zapier as it doesn't have a webhook response module.. you have to use make.com or n8n instead...
j
Is that correct?
o
yes, correct
j
When I run it through the test in the dashboard it works, but not when I go live
o
During the time you were running the bot in the dashboard, did you trigger the zapier webhook also??
j
yes when I run it in the dashboard it triggers the zapier webhook. Just not when it runs live
o
Can we try make.com then? What is your use case?