Programmatically initiating a call to invoke a wor...
# support
m
I have succeeded in programmatically creating a workflow, and have a workflow_id. Now, how can I programmatically start a call with that workflow? It is clear how to attach an assistant to a workflow via UI, but not via API. Ideally, that would be a transient assistant. I tried the suggestion elsewehere to add it to the
toolsId
array, "Couldn't Get Tool.
toolId
3c1a355e-e66c-4864-afc8-f67c6dfaa1bb Does Not Exist ...but that did not work. Thank you. M.
v
Based on the information I found, while there's no direct method to start a call with a specific workflow_id, you can use a transient assistant when initiating a call via the API. Here's how:
Copy code
curl
curl -X POST https://api.vapi.ai/call \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "assistant": {
    "model": {
      "provider": "openai",
      "model": "gpt-4o",
      "toolIds": ["YOUR_WORKFLOW_TOOL_ID"]
    }
  }
}'
This creates an ephemeral assistant configured with your workflow tool for that specific call only. Sources: - [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web) - [Discord Channel Discussion](https://discord.com/channels/1211482211119796234/1333975440003563604)
m
It would seem that having "vapi" as the provider makes the most sense as this is how the UI works, but seeking guidance. https://cdn.discordapp.com/attachments/1364442475820744704/1364456037842813028/image.png?ex=6809bc35&is=68086ab5&hm=6446c726f8683cfba7df3574e20f20cb97fc93226cffee1d2a38ca029bdcd5b8&
s
As of know you can only attach the workflow to the assistant using UI only, the APIs are made not public yet.
m
Ah. FYI that completely nukes my use case, from what I can see. Our workflows are customized for each user. So we generate them through the API. It is an onboarding process, so there is no time for us to manually attach the custom workflow to what would need to be a custom assistant manually each time.I guess we could create a bounded set of say 10 assistants-workflows, edit the workflow programatically, and cycle among assistants for each user. Kind of a round-robin given that workflows are statically bound to assistants (from a programmatic perspective). If you can think of an alternative let me know. 😥
2 Views