KapsoEx.Workflows (kapso_ex v0.1.0)

Copy Markdown View Source

Workflows: automated WhatsApp conversations built from nodes and edges.

Executions are in KapsoEx.Workflows.Executions and triggers in KapsoEx.Workflows.Triggers.

Summary

Functions

Creates a draft workflow. Attributes: name (required), slug, description, definition (%{nodes: [...], edges: [...]}).

Gets workflow metadata, status and execution stats (without the definition).

Gets the workflow with its editor definition (nodes and edges).

Gets the system variables and the variables discovered from past executions.

Lists workflows, newest first.

Updates a workflow. Attributes: name, slug, description, status ("draft", "active", "archived"), message_debounce_seconds, inbound_message_read_mode, definition, and lock_version for optimistic locking.

Types

result()

@type result() :: {:ok, map()} | {:error, KapsoEx.Error.t()}

Functions

create(client, attrs)

@spec create(KapsoEx.Client.t(), map() | keyword()) :: result()

Creates a draft workflow. Attributes: name (required), slug, description, definition (%{nodes: [...], edges: [...]}).

get(client, workflow_id)

@spec get(KapsoEx.Client.t(), String.t()) :: result()

Gets workflow metadata, status and execution stats (without the definition).

get_definition(client, workflow_id)

@spec get_definition(KapsoEx.Client.t(), String.t()) :: result()

Gets the workflow with its editor definition (nodes and edges).

get_variables(client, workflow_id)

@spec get_variables(KapsoEx.Client.t(), String.t()) :: result()

Gets the system variables and the variables discovered from past executions.

list(client, params \\ [])

@spec list(KapsoEx.Client.t(), map() | keyword()) :: result()

Lists workflows, newest first.

Params: status, name_contains, created_after, created_before.

update(client, workflow_id, attrs)

@spec update(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()

Updates a workflow. Attributes: name, slug, description, status ("draft", "active", "archived"), message_debounce_seconds, inbound_message_read_mode, definition, and lock_version for optimistic locking.

Workflows.update(client, workflow_id, status: "active")