saulgoodman4072
03/27/2025, 2:24 PMVapi Support Bot
03/27/2025, 2:26 PMassistantOverrides
with metadata
or variableValues
The most direct way to include shipment details is through the assistantOverrides
object in your API payload. There are two main approaches:
### 1. Using assistantOverrides.metadata
You can include shipment details in the metadata
field as shown in your example:
json
{
"assistantOverrides": {
"metadata": {
"content": "BOL# 5666, driver number: 913-289-1827, destination: Salt Lake City, Utah, Appointment time: March 30th 8:00 AM"
}
}
}
### 2. Using assistantOverrides.variableValues
(Recommended)
This is often more structured and reliable for dynamic content. You'll need to set up template variables in your assistant's prompts first:
json
{
"assistantOverrides": {
"variableValues": {
"bol_number": "5666",
"driver_number": "913-289-1827",
"destination": "Salt Lake City, Utah",
"appointment_time": "March 30th 8:00 AM"
}
}
}
Then in your assistant's prompts, use the variables like: Hello driver, I'm calling about shipment {{bol_number}} headed to {{destination}}
.
According to [Vapi's documentation on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables), you need to add the {{variableName}}
in this format in all your prompts where you want to use the variable.
## Other Methods to Include Context
### Using a Knowledge Base
You can create a knowledge base with shipment details and attach it to your assistant via the PATCH endpoint:
```json
{
"model": {
"knowledgeBaseId": "",
"temperature": 0.2,
"provider": "openai",
"model": "gpt-4o",
"messages": [
{Vapi Support Bot
03/27/2025, 2:26 PMShubham Bajaj
03/29/2025, 7:05 AMassistantOverrides
parameter with variableValues
. This allows you to inject dynamic data into your static workflow without needing tool calls.
## Detailed Solution
Based on the codebase, here's how you can include shipment details in your workflow:
1. **Use assistantOverrides
with `variableValues`**:
When creating a call, you can pass an assistantOverrides
object that includes variableValues
containing all your shipment details:
javascript
const response = await vapiClient.calls.create({
phoneNumberId: "your-phone-number-id",
customer: { number: "driver-phone-number" },
assistantId: "your-workflow-assistant-id",
assistantOverrides: {
variableValues: {
shipment: {
id: "SH12345",
destination: "123 Main St, Anytown, USA",
expectedArrival: "2023-06-01T14:00:00Z",
status: "In Transit",
items: ["Item1", "Item2"],
weight: "2500 lbs",
specialInstructions: "Fragile items, handle with care"
},
driver: {
name: "John Smith",
vehicleId: "V789"
}
}
}
});
2. **Reference these variables in your workflow**:
In your workflow, you can reference these variables using LiquidJS syntax:
Hello {{ driver.name }}, I'm calling about shipment {{ shipment.id }}
that is heading to {{ shipment.destination }}.
The expected arrival time is {{ shipment.expectedArrival | date: "%b %d, %Y, %I:%M %p" }}.
3. **Access in nodes**:
The workflow system automatically processes these variables and substitutes them in your workflow's text content, including in:
- Node content in say/gather nodes