KapsoEx.Workflows.Triggers (kapso_ex v0.1.0)

Copy Markdown View Source

Triggers start a workflow automatically: on an inbound message, a WhatsApp event, a project event, or an API call.

A trigger map has trigger_type ("inbound_message", "api_call", "whatsapp_event", "project_event"), active, and type specific fields: phone_number_id, event, event_name, property_key, operator and property_value.

Summary

Functions

Deletes a trigger.

Lists a workflow's triggers.

Atomically replaces every trigger of a workflow. If any trigger is invalid, nothing changes.

Updates a trigger. Only active can be changed.

Types

result()

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

Functions

create(client, workflow_id, attrs)

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

Creates a trigger.

Triggers.create(client, workflow_id, trigger_type: "inbound_message", phone_number_id: pnid)

delete(client, trigger_id)

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

Deletes a trigger.

list(client, workflow_id)

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

Lists a workflow's triggers.

replace(client, workflow_id, triggers)

@spec replace(KapsoEx.Client.t(), String.t(), [map()]) :: result()

Atomically replaces every trigger of a workflow. If any trigger is invalid, nothing changes.

update(client, trigger_id, attrs)

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

Updates a trigger. Only active can be changed.