Recurring JSON Validation Error: "Unknown Value Pa...
# support
a
Dear VAPI Support Team, I’m reaching out because I’m facing a recurring issue with your API. Every time I try to add a variable or an object with properties in the JSON payload, I get the following error: {"message":["an unknown value was passed to the validate function"],"error":"Bad Request","statusCode":400} This happens whether I make the API call through Make.com or Git Bash to POST a Block. Here’s what I’ve been doing: I followed the instructions on swagger, and this is my test schema: [ { "type": "handoff", "name": "start", "block": { "name": "conversation", "type": "conversation", "messages": [ { "type": "block-start", "content": "" }, { "type": "block-complete", "content": "" } ], "inputSchema": { "type": "array", "items": { "type": "object", "properties": { "customerName": { "type": "string" }, "CVreport": { "type": "string" }, "applyingTo": { "type": "string" } }, "required": ["customerName", "CVreport", "applyingTo"] } }, "instruction": "Hello is this {{customerName}}??", "outputSchema": { "type": "object", "properties": {} } }, "input": [ { "customerName": "John Doe", "CVreport": "Some Report", "applyingTo": "Some Job" } ], "destinations": [], "metadata": { "nodeType": "start", "position": { "x": 0, "y": -2.5 } } } ] i'm just trying to add some variables i can use dynamically in a workflow block, i am trying this way because just sending a value of {{customerName}} through the api call wasnt working. so i am trying to build the block through an api key with a predefined object and properties. but its not working also. What might be causing this issue? Thank you.
i get the same error even without this section: "input": [ { "customerName": "John Doe", "CVreport": "Some Report", "applyingTo": "Some Job" this section i added it just to test if the problem is that the variables dont have values... please can someone help?
@User @User
@Shubham Bajaj
@Vapi
v
@almighty9199 Hello, Thank you for reaching out with the details of the issue you're experiencing. It seems like there might be a problem with the structure of the JSON payload or the way the variables are being passed to the API. The error message indicates that the validation function is receiving a value it doesn't recognize or expect. This could be due to a number of reasons, such as a mismatch between the schema definition and the actual data being sent, or a formatting issue within the JSON payload. To assist you better, could you please provide the exact payload you're sending when you encounter this error, without the "input" section you mentioned? Additionally, it would be helpful to know if you've made any changes to the schema or the way you're passing the variables since the error occurred. Once I have this information, I'll be able to guide you more accurately towards a resolution. If the issue persists, we may need to look into the API logs or further details of the API call you're making to identify the root cause. Looking forward to your response so we can help you resolve this as soon as possible.
a
[ { "type": "handoff", "name": "start", "block": { "name": "conversation", "type": "conversation", "messages": [ { "type": "block-start", "content": "" }, { "type": "block-complete", "content": "" } ], "inputSchema": { "type": "array", "items": { "type": "string" } }, "instruction": "Hello is this {{customerName}}??", "outputSchema": { "type": "object", "properties": {} } }, "input": {}, "destinations": [], "metadata": { "nodeType": "start", "position": { "x": 0, "y": -2.5 } } } ] this is the json i also have the correct headers: authorization and content type, and i am using this url:https://api.vapi.ai/block i hope those are enough for you to diagnose the problem
@Vapi
v
@almighty9199 Thank you for providing the JSON payload and additional details. Based on the information you've shared, it appears that there might be a discrepancy between the
inputSchema
and the
input
provided in your payload. In the JSON schema you've provided, the
inputSchema
is defined as an array of strings, but the
input
is an empty object. This mismatch could be the reason why the validation function is throwing an error. Here's what you might need to consider: 1. The
inputSchema
should match the structure of the
input
you're sending. If you're expecting an object with properties like
customerName
, the
inputSchema
should reflect that. 2. The
instruction
field contains a placeholder
{{customerName}}
, which suggests that you're expecting a variable with the name
customerName
to be replaced dynamically. However, the
input
does not provide a value for
customerName
. To resolve this issue, you should align the
inputSchema
with the expected structure of the
input
. Here's an example of how you might define the
inputSchema
if you're expecting an object with the properties
customerName
,
CVreport
, and `applyingTo`:
Copy code
json
"inputSchema": {
  "type": "object",
  "properties": {
    "customerName": { "type": "string" },
    "CVreport": { "type": "string" },
    "applyingTo": { "type": "string" }
  },
  "required": ["customerName", "CVreport", "applyingTo"]
}
And the
input
should provide values for these properties:
Copy code
json
"input": {
  "customerName": "John Doe",
  "CVreport": "Some Report",
  "applyingTo": "Some Job"
}
Please update your JSON payload to ensure that the
inputSchema
and
input
are consistent with each other and try making the API call again. If the problem persists, please let me know, and we can investigate further. I hope this helps! If you have any more questions or need further assistance, feel free to ask.
a
now what is the problem with this one: [ { "type": "handoff", "name": "start", "block": { "name": "conversation", "type": "conversation", "messages": [ { "type": "block-start", "content": "" }, { "type": "block-complete", "content": "" } ], "inputSchema": { "type": "object", "properties": { "customerName": { "type": "string", "description": "The name of the customer" }, "applyingTo": { "type": "string", "description": "The job or role the customer is applying to" }, "CVreport": { "type": "string", "description": "The customer's CV report" } }, "required": ["customerName", "applyingTo", "CVreport"] }, "instruction": "Hello is this {{customerName}}??", "outputSchema": { "type": "object", "properties": {} } }, "input": {}, "destinations": [], "metadata": { "nodeType": "start", "position": { "x": 0, "y": -2.5 } } } ]
@Vapi
v
@almighty9199 The updated JSON payload you've provided looks more consistent in terms of the
inputSchema
definition. However, the
input
field is still an empty object, which does not provide any values for the required properties defined in the
inputSchema
. To fix this issue, you need to populate the
input
field with an object that contains the keys
customerName
,
applyingTo
, and
CVreport
, along with their respective values. Here's how you can modify the
input
field:
Copy code
json
"input": {
  "customerName": "John Doe",
  "CVreport": "Some Report",
  "applyingTo": "Some Job"
}
This will ensure that the
input
matches the structure required by the
inputSchema
and provides the necessary data for the
instruction
field to dynamically replace the
{{customerName}}
placeholder. Please update the
input
field with the appropriate values and try making the API call again. If you encounter any further issues, don't hesitate to reach out for more assistance. I hope this resolves the problem! Let me know if there's anything else I can help you with.
a
i want vapi to take the input from make.com http request to make a call in another jsonschema.
@Vapi
can't i do that? or should i populate the input
@Vapi
v
@almighty9199 Absolutely, you can use VAPI to take input from an HTTP request made through Make.com (formerly Integromat) and use that input to make a call in another JSON schema. To achieve this, you need to ensure that the input received from Make.com is correctly mapped to the
input
field in your VAPI payload. Here's what you need to do: 1. **Set up your Make.com scenario**: Configure the HTTP request module in Make.com to capture the data you want to send to VAPI. This data should be structured according to the
inputSchema
you've defined in your VAPI payload. 2. **Map the input data**: In the JSON payload that you're sending to VAPI, you need to map the data from Make.com to the
input
field. For example, if Make.com sends a JSON object with
customerName
,
CVreport
, and
applyingTo
, your VAPI payload's
input
field should look like this:
Copy code
json
"input": {
  "customerName": "{{customerName_from_Make}}",
  "CVreport": "{{CVreport_from_Make}}",
  "applyingTo": "{{applyingTo_from_Make}}"
}
Replace
{{customerName_from_Make}}
,
{{CVreport_from_Make}}
, and
{{applyingTo_from_Make}}
with the actual data placeholders or variables provided by Make.com that correspond to the values you want to send. 3. **Ensure dynamic data replacement**: When VAPI processes the payload, it will replace the placeholders in the
instruction
field with the values from the
input
field. Make sure that the placeholders in the
instruction
field match the keys in the
input
object. If you're still having trouble, please ensure that the data from Make.com is being sent in the correct format and that the placeholders in your VAPI payload are correctly set up to receive this data. If you need to troubleshoot further, you might want to test the integration step by step to identify where the issue might be occurring. If you require more specific guidance or if there's anything else I can assist you with, please let me know!
a
what is this error [400] Bad Request what does is represent
@Vapi
v
@almighty9199 The HTTP 400 Bad Request error indicates that the server cannot process the request due to a client error. This can happen for several reasons, often related to the data sent in the request. Here are some common causes for a 400 Bad Request error: 1. **Malformed Syntax**: The request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications. 2. **Invalid URL**: The URL or its parameters could be incorrectly formatted. 3. **Invalid Payload**: If you're sending a JSON payload, it might be improperly formatted or not match the expected schema. 4. **Missing Data**: Required data might be missing from the request. 5. **Data Validation Failure**: The data sent in the request could fail validation checks on the server side, for example, missing required fields or incorrect data types. 6. **Headers Issues**: There could be problems with the request headers, such as missing required headers or incorrect content types. To resolve a 400 Bad Request error, you should: - Check the request URL and ensure it is correct. - Validate the JSON payload against the expected schema. - Ensure all required data is included in the request. - Review the request headers to ensure they are set correctly. - Look for detailed error messages in the server's response, which can provide more insight into what needs to be fixed. If you're still unsure about the cause of the error, you may need to consult the API documentation or reach out to the API support team for further assistance. If you provide the exact request you're making, I can help you troubleshoot the issue more effectively.
a
what is the expected schema?
@Vapi
@Vapi
hello? you told me to validate the json payload against the expected schema, where can i find the expected schema. @Vapi
v
@almighty9199 I apologize for any confusion. The expected schema refers to the structure and format of the data that the API is designed to accept. You can typically find the expected schema in the API documentation provided by the service you are using. For VAPI, the expected schema would be detailed in the API documentation or Swagger/OpenAPI definitions that describe the endpoints, request methods, required fields, data types, and other relevant information you need to construct a valid request. If you have access to the API documentation, you should look for sections that describe the payload structure for the specific endpoint you are trying to use. The documentation will often include examples of valid requests and the corresponding schemas. If you do not have the documentation or are having trouble locating the expected schema, you may need to contact the support team for the API service to request this information. Once you have the expected schema, you can compare it with the JSON payload you are sending to ensure that your request matches the required structure, includes all necessary fields, and uses the correct data types. If you need further assistance with finding the expected schema or have any other questions, please let me know, and I'll do my best to help you.
s
@almighty9199 Blocks and Workflows are currently in beta mode and not yet ready for development and production use. We are actively reworking blocks and you may experience some issues. We recommend using Assistants with prompting and other API resources instead. You can expect blocks to be stable by the end of this quarter.
12 Views