spiritual-aqua
spiritual-aqua16mo ago

Making Vapi 'know' things

How can I give variables with an API call so the AI 'knows' stuff like name, email, customer number etc?
4 Replies
Vapi
Vapi16mo ago
@Ivo Schipper To provide variables such as name, email, customer number, etc., when making an API call, you typically include these as parameters in your request. Depending on the API's design, this can be done in several ways: 1. Query Parameters: For GET requests, you can append the variables to the endpoint URL as query parameters. Example: https://api.example.com/users?name=John&email=john@example.com&customerNumber=12345 2. Request Body: For POST, PUT, or PATCH requests, you can include the variables in the request body, usually as a JSON object. Example:
{
"name": "John",
"email": "john@example.com",
"customerNumber": "12345"
}

{
"name": "John",
"email": "john@example.com",
"customerNumber": "12345"
}

3. Path Parameters: Some APIs require variables to be part of the URL path. Example: https://api.example.com/users/12345/details 4. Headers: Occasionally, you might pass certain information as custom headers in the request. Example:
X-Customer-Number: 12345
X-User-Email: john@example.com

X-Customer-Number: 12345
X-User-Email: john@example.com

When designing or using a Voice API (VAPI), you would typically define the parameters in your API documentation and expect users to provide them in the manner you've specified. If you're using a VAPI and need to pass these variables, you should refer to the API's documentation to understand the expected format for including such information in your API calls. You can continue this conversation by mentioning me in the message. @Ivo Schipper To provide variables such as name, email, customer number, etc., to an API, you typically include these as parameters in your API request. Depending on the API's design, these parameters can be passed in various parts of the request: 1. Query Parameters: Appended to the end of the URL, typically for GET requests. - Example: https://api.example.com/users?name=John&email=john@example.com 2. Path Parameters: Included within the URL path, often used to identify a specific resource. - Example: https://api.example.com/users/12345 (where 12345 is the customer number) 3. Request Body: Sent as JSON or form data in the body of the request, commonly used with POST or PUT requests. - Example:
{
"name": "John",
"email": "john@example.com",
"customerNumber": "12345"
}

{
"name": "John",
"email": "john@example.com",
"customerNumber": "12345"
}

4. Headers: Sometimes used for authentication or to pass additional metadata. - Example: Authorization: Bearer YOUR_ACCESS_TOKEN When you're working with a Voice API (VAPI), you would typically send these parameters in the body of your POST request if you're initiating a call or sending a command that requires this information. The exact format and field names would depend on the API's documentation. If you're developing voice applications and need to pass this information to the AI, you would structure your API calls according to the API's specification, ensuring that all required parameters are included in your request. Would you like to know how to structure an API call for a specific API, or do you need assistance with a particular Voice API feature? You can continue this conversation by mentioning me in the message.
constant-blue
constant-blue16mo ago
Vapi
Community Videos - Vapi
Videos showcasing Vapi out in the wild.
spiritual-aqua
spiritual-aquaOP16mo ago
Using the following now: "assistantOverride": { "variableValues": { "contactName": "John", "contactPhone": "+1234567890", "contactEmail": "ivo@example.com" } } But it says there cannot be an assitant override?
continuing-cyan
continuing-cyan16mo ago
^ Check the community video section

Did you find this page helpful?