https://retellai.com/?utm_source=discord&utm_medium=seo logo
A function call is only passing the phone_number v...
# ❓・ai-evy-support
k
@AI Evy A function call is only passing the phone_number variable, but not passing the SMS_text variable as a parameter to the webhook. The SMS_text variable is set to a fixed message. Any idea why this is happening?
a
Thanks for tagging me @kevinstonepdx. I'll look through relevant sources and get back to you shortly.
### Answer Based on the documentation, there are several potential reasons why your SMS_text variable isn't being passed to the webhook. Here are the most common issues to check: 1. Parameter Schema Definition Make sure both variables are properly defined in your function's parameter schema [(1) ]() [(2) ]() . The parameters must be defined using JSON schema format:
Copy code
json
{
  "type": "object",
  "properties": {
    "phone_number": {
      "type": "string",
      "description": "The phone number to send SMS to"
    },
    "SMS_text": {
      "type": "string", 
      "description": "The SMS message text to send"
    }
  },
  "required": [
    "phone_number",
    "SMS_text"
  ]
}
2. HTTP Method Limitation Parameter definitions are only available for POST, PATCH, and PUT requests . If you're using GET or DELETE methods, parameters won't be sent in the request body. 3. Common Schema Mistakes A frequent issue is not adding
"type": "object"
to the top level of the JSON schema . This can cause the function to fail saving or not pass parameters correctly. 4. Prompt Instructions Ensure your prompt explicitly instructs the LLM when and how to use both parameters [(2) ]() . For example:
Copy code
When sending an SMS, call the send_sms function with both the phone_number and SMS_text parameters.
5. Request Body Structure When the function is called, Retell sends the parameters in the
args
object within the request body [(1) ]() [(2) ]() :
Copy code
json
{
  "name": "your_function_name",
  "call": {...},
  "args": {
    "phone_number": "value",
    "SMS_text": "value"
  }
}
Troubleshooting Steps: 1. Verify both parameters are in your JSON schema with proper types and descriptions 2. Check that you're using POST, PATCH, or PUT method 3. Ensure
"type": "object"
is at the top level of your schema 4. Update your prompt to explicitly mention using both parameters 5. Test that your webhook endpoint is correctly parsing the
args
object If the issue persists after checking these items, you might want to examine the actual request payload being sent to your webhook to see which parameters are included.
​ 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.