FlowRun

FlowRun is responsible for initiating a Flow in a MessageThread. The FlowRun resource reflects the flow's current state of the flow, including session variables, the present costs incurred in association with the FlowRun and the status attribute displaying the flow's execution state.

Endpoints

  • GET /flow-runs - Retrieve a list of all FlowRun.

  • GET /flow-runs/{id} - Retrieve a specific FlowRun by ID.

  • POST /flow-runs - Trigger a new FlowRun in a MessageThread.

  • PATCH /flow-runs/{id} - Update a specific FlowRun by ID.

  • DELETE /flow-runs/{id} - Delete a specific FlowRun by ID.

Patching a FlowRun

The following attributes can be patched in a FlowRun:

  • state - The state attribute can can only be updated once a FlowRun is not in a running state. By patching the state attribute you can delete any personal data or other sensitive information from the state.

  • status - The status attribute can be updated to finished, timeout, cancelled or exception. This can be used to manually finish a flow run or to mark it as a timeout or exception.

Attributes

Field
Type
Description

flowId

UUID

Id of the Flow to be triggered.

messageThreadId

UUID

Id of the MessageThread to trigger the flow on.

state

JSON object

The initial state of the flow run, including session variables.

initialMessage

JSON object

The message to be sent to the candidate when the flow is triggered. Type depends on the channel; for WhatsApp, a template is required. If no message is provided, the flow will be triggered without sending a message to the candidate; this will still mean that the candidate will enter the correct flow upon the next message send. Please set to {} if you wish for no initialMessage.

status

String

The current status of the flow run, which can be one of "running", "finished", "timeout", "exception", "queued".

cost

integer

The current cost in credits of the flow run.

createdAt

DateTime

The timestamp when the flow run was created.

updatedAt

DateTime

The timestamp when the flow run was last updated.

HTTP Methods

Field
GET
POST
PATCH

flowId

X

X

messageThreadId

X

X

state

X

X

X

initialMessage

X

X

status

X

cost

X

createdAt

X

updatedAt

X

Required Fields for Creation (POST)

Field
Type
Example value

flowId

UUID

cacc1a00-b59f-44da-8a48-d99db3473389

messageThreadId

UUID

cacc1a00-b59f-44da-8a48-d99db3473389

state

JSON object

{}

initialMessage

JSON object

{"type":"template","template":{"id":"7f9a9715-5e7c-4328-ab47-bb9e595438c9","components":[{"type":"body","parameters":[{"type":"text","text":"John"}]}]}}

Initial Message

The initial message is the message that will be sent to the candidate when the flow is triggered. The type of the initial message depends on the channel, for whatsapp a template is required. If no message is provided, the flow will be triggered without sending a message to the candidate this will still mean that the candidate will enter the correct flow upon sending a message.

The initial message can be any of the available Payload values, see the Message resource for more information.

Example POST body

Example PATCH body

Scheduling

If you have generated a flow with a scheduling step where the mode is set to mode: 'custom' you can provide the Schedule Id when starting the flow by including the following:

OpenAPI

Create a FlowRun

post
Authorizations
AuthorizationstringRequired

Bearer

Body
Responses
post
/flow-runs

Destroy a Candidate

delete
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Responses
delete
/candidates/{id}

No content

Retrieve a single flow_run

get
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Responses
200

flow_run found

application/vnd.api+json
get
/flow-runs/{id}

Destroy a FlowRun

delete
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Responses
delete
/flow-runs/{id}

No content

Update a FlowRun

patch
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Body
Responses
200

flow_run updated

application/vnd.api+json
patch
/flow-runs/{id}

Retrieve a single flow_run including flow

get
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Responses
200

flow_run found with included flow

application/vnd.api+json
get
/flow_runs/{id}?include=flow
200

flow_run found with included flow

Retrieve a single flow_run including messageThread

get
Authorizations
AuthorizationstringRequired

Bearer

Path parameters
idstringRequired
Responses
200

flow_run found with included messageThread

application/vnd.api+json
get
/flow_runs/{id}?include=messageThread
200

flow_run found with included messageThread

Retrieve all FlowRuns

get
Authorizations
AuthorizationstringRequired

Bearer

Responses
200

flow_runs found

application/vnd.api+json
get
/flow-runs

Last updated