WhatsApp Flows managed by Kapso: versions, publishing, encryption and data endpoints (serverless functions that serve dynamic flow data).
See Flows in Kapso.
To send a flow, use KapsoEx.WhatsApp.Messages.send_flow/6.
Summary
Functions
Attaches an existing deployed function as the flow's data endpoint and registers it with Meta. Several flows can share one function.
Creates a flow. Attributes: phone_number_id (required), name,
flow_json (a map; defaults to a basic welcome screen) and publish.
Uploads new flow JSON as a new version and syncs it with Meta.
Deploys the data endpoint function.
Gets recent invocations of the data endpoint function. Params: status, limit.
Gets logs of the data endpoint function (shared functions include every
flow's activity). Params: limit.
Gets a flow.
Gets the data endpoint function of a flow.
Gets a flow version, including its flow JSON.
Lists flows, most recent first.
Lists flow versions, most recent first. Params: page, per_page.
Publishes a draft flow. Published flows cannot be unpublished. Attributes: phone_number_id.
Creates or updates the data endpoint function code (JavaScript). Deploy
it with deploy_data_endpoint/2 and register it with
register_data_endpoint/2.
Registers the deployed data endpoint URL with Meta. Requires flows encryption.
Sets up flows encryption for the flow's WABA, required by data
endpoints. Attributes: phone_number_id.
Types
@type result() :: {:ok, map()} | {:error, KapsoEx.Error.t()}
Functions
@spec attach_data_endpoint(KapsoEx.Client.t(), String.t(), String.t()) :: result()
Attaches an existing deployed function as the flow's data endpoint and registers it with Meta. Several flows can share one function.
@spec create(KapsoEx.Client.t(), map() | keyword()) :: result()
Creates a flow. Attributes: phone_number_id (required), name,
flow_json (a map; defaults to a basic welcome screen) and publish.
@spec create_version(KapsoEx.Client.t(), String.t(), map(), keyword()) :: result()
Uploads new flow JSON as a new version and syncs it with Meta.
Options
:phone_number_id
@spec deploy_data_endpoint(KapsoEx.Client.t(), String.t()) :: result()
Deploys the data endpoint function.
@spec function_invocations(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Gets recent invocations of the data endpoint function. Params: status, limit.
@spec function_logs(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Gets logs of the data endpoint function (shared functions include every
flow's activity). Params: limit.
@spec get(KapsoEx.Client.t(), String.t()) :: result()
Gets a flow.
@spec get_data_endpoint(KapsoEx.Client.t(), String.t()) :: result()
Gets the data endpoint function of a flow.
@spec get_version(KapsoEx.Client.t(), String.t(), String.t()) :: result()
Gets a flow version, including its flow JSON.
@spec list(KapsoEx.Client.t(), map() | keyword()) :: result()
Lists flows, most recent first.
Params: status, business_account_id, phone_number_id,
name_contains, created_after, created_before, page, per_page.
@spec list_versions(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Lists flow versions, most recent first. Params: page, per_page.
@spec publish(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Publishes a draft flow. Published flows cannot be unpublished. Attributes: phone_number_id.
@spec put_data_endpoint(KapsoEx.Client.t(), String.t(), String.t()) :: result()
Creates or updates the data endpoint function code (JavaScript). Deploy
it with deploy_data_endpoint/2 and register it with
register_data_endpoint/2.
@spec register_data_endpoint(KapsoEx.Client.t(), String.t()) :: result()
Registers the deployed data endpoint URL with Meta. Requires flows encryption.
@spec setup_encryption(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Sets up flows encryption for the flow's WABA, required by data
endpoints. Attributes: phone_number_id.