Skip to content

Commit 9062d00

Browse files
authored
Split dynamic variables into new tab (#70)
1 parent 26995f3 commit 9062d00

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

assistants/dynamic-variables.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "Dynamic Variables"
3+
sidebarTitle: "Dynamic Variables"
4+
description: "Vapi makes it easy to personalize an assistant's messages and prompts using variables, allowing each call to be customized."
5+
---
6+
7+
Prompts, messages, and other assistant properties can be dynamically set when starting a call based on templates.
8+
These templates are defined using double curly braces `{{variableName}}`.
9+
This is useful when you want to customize the assistant for a specific call.
10+
11+
For example, you could set the assistant's first message to "Hello, `{{name}}`!" and then set `name` to `John` when starting the call
12+
by passing `assistantOverrides` with `variableValues` to the API or SDK:
13+
14+
```json
15+
{
16+
"variableValues": {
17+
"name": "John"
18+
}
19+
}
20+
```
21+
22+
## Default Variables
23+
24+
By default, the following variables are automatically filled based on the current (UTC) time,
25+
meaning that you don't need to set them manually in `variableValues`:
26+
27+
| Variable | Description | Example |
28+
| ----------- | --------------------------- | -------------------- |
29+
| `{{now}}` | Current date and time (UTC) | Jan 1, 2024 12:00 PM |
30+
| `{{date}}` | Current date (UTC) | Jan 1, 2024 |
31+
| `{{time}}` | Current time (UTC) | 12:00 PM |
32+
| `{{month}}` | Current month (UTC) | January |
33+
| `{{day}}` | Current day of month (UTC) | 1 |
34+
| `{{year}}` | Current year (UTC) | 2024 |

assistants/persistent-assistants.mdx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,3 @@ The `/assistant` endpoint is there for convenience to save you creating your own
1414
</Accordion>
1515

1616
Otherwise, you can just specify the assistant configuration when starting a call.
17-
18-
## Variables
19-
20-
Prompts, messages, and other assistant properties can be dynamically set when starting a call based on templates.
21-
These templates are defined using double curly braces `{{variableName}}`.
22-
This is useful when you want to customize the assistant for a specific call.
23-
24-
For example, you could set the assistant's first message to "Hello, `{{name}}`!" and then set `name` to `John` when starting the call
25-
by passing `assistantOverrides` with `variableValues` to the API or SDK:
26-
27-
```json
28-
{
29-
"variableValues": {
30-
"name": "John"
31-
}
32-
}
33-
```
34-
35-
#### Default variables
36-
37-
By default, the following variables are automatically filled based on the current (UTC) time,
38-
meaning that you don't need to set them manually in `variableValues`:
39-
40-
| Variable | Description | Example |
41-
| ----------- | ------------------------------ | -------------------- |
42-
| `{{now}}` | Current date and time (UTC) | Jan 1, 2024 12:00 PM |
43-
| `{{date}}` | Current date (UTC) | Jan 1, 2024 |
44-
| `{{time}}` | Current time (UTC) | 12:00 PM |
45-
| `{{month}}` | Current month (UTC) | January |
46-
| `{{day}}` | Current day of month (UTC) | 1 |
47-
| `{{year}}` | Current year (UTC) | 2024 |

mint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"assistants/custom-voice",
156156
"assistants/custom-llm",
157157
"assistants/persistent-assistants",
158+
"assistants/dynamic-variables",
158159
"assistants/background-messages"
159160
]
160161
},
@@ -319,6 +320,14 @@
319320
"source": "/persistent-assistants",
320321
"destination": "/assistants/persistent-assistants"
321322
},
323+
{
324+
"source": "/dynamic_variables",
325+
"destination": "/assistants/dynamic-variables"
326+
},
327+
{
328+
"source": "/dynamic-variables",
329+
"destination": "/assistants/dynamic-variables"
330+
},
322331
{
323332
"source": "/text_message",
324333
"destination": "/assistants/background-messages"

0 commit comments

Comments
 (0)