https://retellai.com/?utm_source=discord&utm_medium=seo logo
I have a custom function that sends some parameter...
# ❓・ai-evy-support
l
@AI Evy I have a custom function that sends some parameters to my crm 'Podio', but it stopped working. Not sure why, and also I want to be able to retrieve the call ID, but it sometimes sends it and sometimes doesn't. Any idea on how to fix this https://cdn.discordapp.com/attachments/1302816169367044149/1422625583564591336/image.png?ex=68dd5ad2&is=68dc0952&hm=3e4f51bc58b313bdf0f4c2d4a3dec7d1f3a6ec14fd924ac0bfd2f9250dfb98af&
a
Thanks for tagging me @leenalhamwi. I'll look through relevant sources and get back to you shortly.
### Answer For troubleshooting your custom function that stopped working, here are the key areas to check: ## Request Structure and Call Object When Retell sends requests to your endpoint, it includes a
call
object in the request body that contains the call ID and other context [(1) ]() [(2) ]() . The request structure is:
Copy code
json
{
  "name": "function_name",
  "call": "call_object_with_call_id_and_context",
  "args": "function_arguments"
}
[(1) ]() , [(2) ]() The
call
object contains real-time transcript up to the time the request is sent and provides more context about the call, including the call ID [(1) ]() [(2) ]() . ## Common Troubleshooting Steps 1. **Verify Request Authentication**: Check that the
X-Retell-Signature
header is being properly verified using your secret key 2. **Response Format**: Ensure your endpoint returns a status code between 200-299 to indicate success 3. **Function Parameters**: Verify your JSON schema parameters are valid - a common mistake is not adding
"type": "object",
to the top level of the JSON schema 4. **Timeout and Retries**: The request will timeout in your specified timeout period, or 2 minutes if not specified. When requests fail, they will be retried up to 2 times ## Similar Issue Reference There's a documented case where custom functions stopped working due to webhook delivery issues - specifically where only the initial webhook fires but subsequent function calls don't reach the endpoint [(3) ]() . This could be related to your intermittent call ID issue. To debug the call ID inconsistency, I'd recommend adding logging to your endpoint to verify: - Whether the
call
object is consistently present in the request body - The structure and content of the
call
object when it arrives If the issue persists, you may want to check your endpoint logs to see if requests are being received consistently from Retell.
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Custom n8n Functions Stopped Working](https://discord.com/channels/1186424376300679209/1360106227560087552) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
l
I need to send the call ID as a parameter using a custom function. How can I do that
@AI Evy
a
Thanks for the follow-up, @leenalhamwi. I'll get back to you soon.
### Answer When Retell sends requests to your custom function endpoint, it automatically includes a
call
object in the request body that contains the call ID and other context [(1) ]() [(2) ]() . The request structure is:
Copy code
json
{
  "name": "the name of the custom function",
  "call": "the call object for you to get more context about the call, it also contains real time transcript up to the time the request is sent",
  "args": "the arguments for the custom function, as a JSON object"
}
The
call
object contains the call ID and provides more context about the call, including real-time transcript up to the time the request is sent . You can access the call ID from this
call
object in your backend endpoint when processing the custom function request. For more details about the call object structure, check out the Get Call API documentation .
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
l
@AI Evy i am using the Payload: args only option and i only need certain vairables and not all to be sent like the call id and call status how can i do that
a
Thanks for the follow-up, @leenalhamwi. I'll get back to you soon.
### Answer Based on the available sources, there's a known issue with the "args only" payload option that you're experiencing [(1) ]() . ## Known Issue with Args Only Option The "args only" option has inconsistent behavior - it sometimes works and sends arguments, but sometimes doesn't pass the function arguments at all . This appears to be model-dependent behavior . ## Model-Specific Behavior The issue seems related to the LLM model being used: - **GPT-4o**: Works correctly with the args only option - **GPT-4o-mini**: Often passes empty args when using this option ## Recommended Solution Switch to a model like GPT-4 or GPT-4o, as the args only option works more reliably with these models . One user confirmed that switching models resolved the issue . ## Alternative Approach If you need specific variables like call ID and call status, you might need to work with the full request structure that includes the
call
object [(2) ]() [(3) ]() , then extract only the variables you need in your backend processing, rather than relying on the args only option. The standard request structure includes: - `name`: the name of the custom function - `call`: the call object containing call ID and other context - `args`: the arguments for the custom function
​ To learn more, see the sources I considered: [[1] pass args only option is bugged](https://discord.com/channels/1186424376300679209/1410837237591183500) [[2] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[3] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.