https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> There are some problems wit...
# 💬・general
e
@AI Evy There are some problems with the function to send with JSON Parameter. do you know the problem? it comes everytime the error: parameter must be object. but my parameter is an object - look: { "parameters": { "maxLength": 2000 } }
a
Thanks for tagging me @enzo_58304. I'll look through relevant sources and get back to you shortly.
### Answer The issue appears to be with your JSON schema format. Based on the documentation, the correct format should have
"type": "object"
at the top level of the schema [(1) ]() . Here's an example of the correct format:
Copy code
javascript
{
  "type": "object",
  "properties": {
    "maxLength": {
      "type": "string",
      "description": "The maximum length"
    }
  },
  "required": ["maxLength"]
}
, [(2) ]() One common mistake noted in the documentation is "not adding
"type": "object"
to the top level of the JSON schema" [(1) ]() . The schema should follow the JSON schema format used for function calling [(2) ]() . For troubleshooting: 1. Ensure you have
"type": "object"
at the top level 2. Define your properties within the
"properties"
object 3. List any required parameters in the
"required"
array 4. Follow the examples provided in the custom function documentation [(1) ]()
​ 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/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
e
@AI Evy so show me the solutions for the right JSON, if i want, that maximum length must be no more then 2000
a
Thanks for the follow-up, @enzo_58304. I'll get back to you soon.
### Answer Based on the documentation, here's the correct JSON schema format for setting a maximum length parameter of 2000:
Copy code
javascript
{
  "type": "object",
  "properties": {
    "maxLength": {
      "type": "number",
      "description": "The maximum length limit",
      "maximum": 2000
    }
  },
  "required": ["maxLength"]
}
[(1) ]() , [(2) ]() Make sure you: 1. Include
"type": "object"
at the top level [(1) ]() 2. Define the parameter under
"properties"
3. Include it in the
"required"
array if the parameter is mandatory If you still encounter issues saving the custom function, verify that the JSON schema format is valid [(3) ]() .
​ 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/custom-function) [[3] JSON Schema not saving in custom functions](https://discord.com/channels/1186424376300679209/1319363416296657039) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
e
@AI Evy kannst du mir das als JSON type: object wandeln?: { "message": "Die Bearbeitungszeit beträgt ca. XX Minuten – In manchen Fällen geht es sogar schneller!" }
a
Thanks for the follow-up, @enzo_58304. I'll get back to you soon.
### Answer Hier ist das korrekte JSON-Schema Format für Ihre Nachricht:
Copy code
javascript
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Die Nachricht über die Bearbeitungszeit"
    }
  },
  "required": ["message"]
}
[(1) ]() , [(2) ]() Wichtige Hinweise: - Das Schema muss
"type": "object"
auf der obersten Ebene haben [(1) ]() - Die Parameter müssen unter
"properties"
definiert werden - Fügen Sie erforderliche Parameter zum
"required"
Array hinzu
​ 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/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.