Hello,
# support
p
I used Vapi in my project and it was work perfect. But recently i notice it has problem. I have node" Hello {{username}}." that use dynamic value which i pass through code vapi.start(process.env.NEXT_PUBLIC_VAPI_WORKFLOW_ID, { variableValues: { userid: userId, username: userName, }, }); but Vapi did not recieve it and use it . what is the problem?
v
It looks like the issue may be that
variableValues
should be nested under
assistantOverrides
in your
vapi.start
call, not passed directly.
For example:
Copy code
js
vapi.start(process.env.NEXT_PUBLIC_VAPI_WORKFLOW_ID, {
  assistantOverrides: {
    variableValues: {
      userid: userId,
      username: userName,
    }
  }
});
Can you try this structure and let me know if the variable is received correctly, or share any specific error message you see? Sources: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables) - [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web#overriding-assistant-configurations)
k
Pass dynamic values using assistant_overrides.variableValues instead of variableValues directly in vapi.start()..
p
both solutions cause error
k
pass dynamic values inside a single object to vapi.start() like this;
Copy code
vapi.start({ assistantId, assistantOverrides: { variableValues: { username, userid } } });
Avoid passing them as a second parameter Vapi only accepts one config object..
c
Parisa, the workflow is the 4th property in the start method, so you need to pass the first three as null or undefined, and then the workflow IDs and so on. You can check out the code inside the Github for more information.
p
thanks i wrote it const assistantOverrides = { variableValues: { userid: userId, username: userName, }, }; await vapi.start(process.env.NEXT_PUBLIC_VAPI_WORKFLOW_ID, assistantOverrides); but it still does not work
c
vapi.start(null, null, null, workflowId)
2 Views