Dynamic Variables not being passed on to a squad
# support
a
I use the below json API prompt to send an outbound call to a squad but the dynamic variables are not being passed on. I have made sure the names match exactly to the prompt { "name": "Stoneink Collection Call", "squadId": "320bbe52-2339-4114-9265-c9623c9d5a6c", "phoneNumberId": "3036a8c6-d792-4f8d-a673-2ef74ed2f10b", "customer": { "number": "+61406421813", "name": "John Smith" }, "assistantOverrides": { "variableValues": { "CurrentDate": "2024-11-08", "fullname": "John Smith", "accountType": "Telecommunications Services", "CurrentBalance": "$500", "DOB": "01/01/1986", "Postcode": "2150", "CaseID": "618963b1-3e0f-ef11-9f89-00224896b7dd", "CustomerID": "STI-102360" } } }
@Vapi what am i doing wrong?
v
@ASh - Stoneink It seems like you've structured your JSON payload correctly with the dynamic variables nested under
assistantOverrides
and
variableValues
. However, if the dynamic variables are not being passed on as expected, here are a few things you might want to check: 1. **API Endpoint and Method**: Ensure you are sending the JSON payload to the correct API endpoint and using the correct HTTP method (usually POST for creating resources). 2. **Headers**: Check if you need to set specific headers, such as
Content-Type: application/json
or any authentication headers required by the API. 3. **Variable Names**: Double-check that the variable names used in your API prompt exactly match the variable names expected by the voice application. They must be case-sensitive and spelled correctly. 4. **API Documentation**: Refer to the API documentation to ensure that the JSON structure aligns with what the API expects. There might be additional nesting or different field names required. 5. **API Version**: Make sure you are using the correct version of the API. Sometimes, APIs get updated, and the way to pass variables might change. 6. **Error Messages**: Look at the response from the API call for any error messages or codes that could give you a hint about what's going wrong. 7. **Testing Tools**: Use API testing tools like Postman to send your requests. These tools can help you debug by showing the raw request and response data. 8. **Logs**: Check the logs on the server-side (if accessible) to see if there's more detailed information about why the variables aren't being passed through. If after checking these points you still face issues, it might be helpful to reach out to the API support team for further assistance. They can provide more specific guidance based on their system's requirements and behaviors.
message has been deleted
@ASh - Stoneink It seems like there might be an issue with how the dynamic variables are being referenced or passed in your API call. To ensure that the dynamic variables are correctly passed on, you should make sure that the variable names used in the API call match the placeholders within the VAPI system exactly. Additionally, the structure of the JSON should align with the expected schema of the API. If you've already verified that the names match and the structure is correct, there might be an issue with the VAPI system itself. In that case, I would recommend reaching out to the support team for further assistance. If you need me to perform any specific actions or if there's anything else I can assist you with, please let me know!
You can continue this conversation by mentioning me in the message.
s
Hey @ASh - Stoneink To help track down this issue, could you share: - The call ID - What response you expected to get - What response you actually got instead This would really help me figure out what went wrong!
a
Hi @Shubham Bajaj this is getting a little bit frustrating i've provided multiple call IDs through the chat. the issue remains the same "ASSISTANT DOES NOT RECOGNIZE DYNAMIC VARIABLES IN A SQUAD API CALL"
s
Hey @ASh - Stoneink apology for the overlook into this, your right here. To use dynamic variables with the squad you have to use transient squad instead of squadId and use member overrides instead, Here's how:-
Copy code
json
curl -X POST https://api.vapi.ai/call \
     -H "Authorization: Bearer " \
     -H "Content-Type: application/json" \
     -d '{
  "squad": {
    "members": [],
    "membersOverrides": {},
    "name": ""
  },
  "customer": {},
  "phoneNumberId": ""
}'
**NOTE: **pass membersOverrides instead of assistantOverrides when same variables overrides
@ASh - Stoneink Do let me know How can I help to unblock you!!
7 Views