Richard
11/26/2024, 8:51 AMRichard
11/26/2024, 8:52 AMVapi
11/26/2024, 8:54 AMcustomVariables
field of the call configuration object.
Here's a sample code snippet to illustrate this:
javascript
const vapi = new Vapi({
// ... other configuration options
});
const customVariables = {
userName: "John",
accountNumber: "123456789"
};
vapi.createCall({
// ... other call options
customVariables: customVariables
});
In this example, userName
and accountNumber
are the dynamic variables that you want to pass to the assistant's system model prompt. When the call is created, these variables will be available for the assistant to use.
Remember to replace userName
and accountNumber
with the actual variables you want to use, and ensure that the assistant's system model prompt is configured to utilize these variables appropriately.
If you need more detailed instructions or have any issues, please ask support for more info on this.Vapi
11/26/2024, 8:54 AMShubham Bajaj
11/29/2024, 2:59 AMts
start(
assistant?: CreateAssistantDTO | string,
assistantOverrides?: AssistantOverrides,
squad?: CreateSquadDTO | string,
)
You need to pass your assistant as first parameter, overrides into second parameter.
ts
start(assistantIdInsertsHere, assistantOverridesInsertsHere)
This is how a web call is created.
ts
async start(
assistant?: CreateAssistantDTO | string,
assistantOverrides?: AssistantOverrides,
squad?: CreateSquadDTO | string,
): Promise<Call | null> {
if (!assistant && !squad) {
throw new Error('Assistant or Squad must be provided.');
}
if (this.started) {
return null;
}
this.started = true;
try {
const webCall = (
await client.call.callControllerCreateWebCall({
assistant: typeof assistant === 'string' ? undefined : assistant,
assistantId: typeof assistant === 'string' ? assistant : undefined,
assistantOverrides,
squad: typeof squad === 'string' ? undefined : squad,
squadId: typeof squad === 'string' ? squad : undefined,
})
).data;
Shubham Bajaj
11/29/2024, 2:59 AM