Start and resume workflow executions and read their history.
Starting executions has an extra per-workflow burst limit (5 to 30 per
second depending on the plan); exceeding it returns 429 with
retry_after: 1 in the KapsoEx.Error.
Summary
Functions
Gets an execution with its context, variables and event history.
Lists a workflow's executions, most recent first.
Lists an execution's events, most recent first. Params: event_type, limit, before, after.
Lists the workflow executions of a WhatsApp conversation, most recent
first. Params: status, limit, before, after.
Resumes an execution in waiting status (for example at a wait for
response step), delivering data as the incoming message.
Starts an execution asynchronously (202, with an id and
tracking_id). The workflow must be active.
Sets the status of an execution: "ended", "handoff" or "waiting".
Types
@type result() :: {:ok, map()} | {:error, KapsoEx.Error.t()}
Functions
@spec get(KapsoEx.Client.t(), String.t()) :: result()
Gets an execution with its context, variables and event history.
@spec list(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Lists a workflow's executions, most recent first.
Params: status, created_after, created_before,
whatsapp_conversation_id, limit, before, after.
@spec list_events(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Lists an execution's events, most recent first. Params: event_type, limit, before, after.
@spec list_for_conversation(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Lists the workflow executions of a WhatsApp conversation, most recent
first. Params: status, limit, before, after.
Resumes an execution in waiting status (for example at a wait for
response step), delivering data as the incoming message.
data is a string, map or list.
Options
:kind- message kind, for example"text".:variables- variables to merge into the execution.
Examples
Executions.resume(client, execution_id, "yes", kind: "text", variables: %{confirmed: true})
@spec start(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Starts an execution asynchronously (202, with an id and
tracking_id). The workflow must be active.
Attributes: phone_number (E.164) and/or recipient (business-scoped
user ID), phone_number_id, variables, context, initial_data.
Executions.start(client, workflow_id,
phone_number: "+56961567267",
phone_number_id: "647015955153740",
variables: %{order_id: "ORD-1234"}
)
@spec update_status(KapsoEx.Client.t(), String.t(), String.t()) :: result()
Sets the status of an execution: "ended", "handoff" or "waiting".