The Workflow API in Cobalt allows users to execute workflows programmatically instead of relying on event-based triggers. This API-based execution provides flexibility in triggering workflows directly through an API call.
Let’s first see how you can setup a Workflow API for any of the workflows that you have in Cobalt.
To set up a workflow to be triggered via the Workflow API:
Navigation
Navigate to the Start Node
of the workflow.
Setup Workflow API
In the Start Node, select the API Call
as the trigger method, make the required changes and click on Save
.
The API Call setup involves three fields:
There are two APIs related to workflow execution: the /execute API
and the /response API
.
To execute a workflow, make a POST request to the workflow execution endpoint.
If a Workflow Alias has been defined, you can replace workflow_id
with the alias
in the API.
Send the event data in the request body, similar to how you would handle event payloads. If there is no payload, you can pass an empty JSON object .
Request Headers
Using Workflow API, the workflow gets executed even for those Linked Accounts who have not enabled the workflow.
slug: Slug of the integration in which workflow is present.
x-api-key: Your Cobalt API key
sync_execution: By default, this is set to false, which means the API response will only include the execution_id
. If you set sync_execution to true, the API response will include both the execution_id
and the return_value
object containing response as set in the Response node.
Sample cURL for Workflow Execute API:
Response
If sync_execution is set to true
and any node has Skip Node on Error enabled, then Node Retry for that node is not allowed in case of a workflow error.
To fetch the response received in a previously executed workflow, use the following API.
Request Headers
linked_account_id: The Linked account for which the workflow was executed.
x-api-key: Your Cobalt API key
Sample cURL for Execution Response API:
Response
The API response will include the data set in the workflow’s Response node, as well as the status
of the workflow, which can be one of the following:
COMPLETED: The workflow has successfully finished.
RUNNING: The workflow is still in progress.
ERRORED: The workflow encountered an error.
The Workflow API in Cobalt allows users to execute workflows programmatically instead of relying on event-based triggers. This API-based execution provides flexibility in triggering workflows directly through an API call.
Let’s first see how you can setup a Workflow API for any of the workflows that you have in Cobalt.
To set up a workflow to be triggered via the Workflow API:
Navigation
Navigate to the Start Node
of the workflow.
Setup Workflow API
In the Start Node, select the API Call
as the trigger method, make the required changes and click on Save
.
The API Call setup involves three fields:
There are two APIs related to workflow execution: the /execute API
and the /response API
.
To execute a workflow, make a POST request to the workflow execution endpoint.
If a Workflow Alias has been defined, you can replace workflow_id
with the alias
in the API.
Send the event data in the request body, similar to how you would handle event payloads. If there is no payload, you can pass an empty JSON object .
Request Headers
Using Workflow API, the workflow gets executed even for those Linked Accounts who have not enabled the workflow.
slug: Slug of the integration in which workflow is present.
x-api-key: Your Cobalt API key
sync_execution: By default, this is set to false, which means the API response will only include the execution_id
. If you set sync_execution to true, the API response will include both the execution_id
and the return_value
object containing response as set in the Response node.
Sample cURL for Workflow Execute API:
Response
If sync_execution is set to true
and any node has Skip Node on Error enabled, then Node Retry for that node is not allowed in case of a workflow error.
To fetch the response received in a previously executed workflow, use the following API.
Request Headers
linked_account_id: The Linked account for which the workflow was executed.
x-api-key: Your Cobalt API key
Sample cURL for Execution Response API:
Response
The API response will include the data set in the workflow’s Response node, as well as the status
of the workflow, which can be one of the following:
COMPLETED: The workflow has successfully finished.
RUNNING: The workflow is still in progress.
ERRORED: The workflow encountered an error.