https://retellai.com/?utm_source=discord&utm_medium=seo logo
im getting 400 when creating custom functions
# ❓・ai-evy-support
s
@AI Evy im getting 400 when creating custom functions.. and help me hoe to setup below workflow .. voice agent anser call identifies caller number lookup some data making api or dunction call using phone number and change the tone, language, accent from the function call response and pass the function call response and pass the reposne to LLM to help caller or answer using the function or capi call response
a
Thanks for tagging me @sekharm_95325. I'll look through relevant sources and get back to you shortly.
### Answer A 400 error when creating custom functions usually means there’s an issue with your function configuration—most commonly with the parameters. Make sure your parameter schema includes "type": "object" at the top level and that all required fields are correctly specified [(1) ]() . Here’s a minimal valid example:
Copy code
json
{
 "type": "object",
 "properties": {
   "city": {
     "type": "string",
     "description": "The city of the weather"
   }
 },
 "required": [
   "city"
 ]
}
For your workflow (voice agent answers, looks up caller number, makes an API call, then adjusts language/tone/accent and passes the response to the LLM) : 1. Custom Function Setup: - In the dashboard, add a custom function to call your API using the caller’s phone number (available as a dynamic variable) . - Configure the endpoint, HTTP method, headers, query params, and parameter schema as needed . 2. Dynamic Variables: - Extract values from your API response (e.g., language or accent) and save them as dynamic variables, which can be referenced later in the conversation flow . 3. Controlling Language/Accent: - Use the dynamic variable from the custom function response to set the agent’s language, tone, or accent in subsequent nodes or prompts. (Direct control of voice features via function response is not explicitly documented, but you can set dynamic variables and use them in prompts or conditions.) 4. Passing API Response to LLM: - The custom function’s response can be passed to the LLM by referencing the extracted dynamic variable in your agent’s prompt or as part of the conversation . If you’re still getting 400 errors, double-check your JSON schema, ensure required fields are present, and that your endpoint is reachable. Also, confirm your headers and authentication are correct . More details: [Integrate any system with custom function]()
​ To learn more, see the sources I considered: [[1] 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.
s
how to creayte edge between nodes ? which key to use ?