extended-salmon•3w ago
Can we create a workflow object and execute it directly in our code?
I’ve been experimenting with the Web SDK. Right now, I’m calling vapi.start with a workflowId that I created beforehand in the dashboard. However, I’d like to avoid creating a new workflow in the web app, I would like to manage this in the code.
Is it possible to define a workflow object directly in my code and pass it to vapi.start (instead of passing a workflowId)? Or do workflows always need to be created via the API/dashboard first?
I would like to define the workflow programmatically and then execute it to manage for example the user prefered language, etc....
1 Reply
No, you don't have to create a workflow via API/dashboard before using the web SDK. Instead, what you are looking for is using transient workflow configurations. These can be created via API or maintained in your code and because they are transient, only exist when the call is initialized. I will provide an example snippet below: