KapsoEx.WhatsApp.Flows (kapso_ex v0.1.0)

Copy Markdown View Source

WhatsApp Flows through Meta's Graph API shapes (proxied by Kapso).

KapsoEx.Platform.Flows offers a higher level API on top of this: flow versions, data endpoints and encryption setup.

Flow-ID endpoints need a context so Kapso can pick the connection: pass phone_number_id: or business_account_id: in params.

Summary

Functions

Creates a flow in a WhatsApp Business Account.

Creates a flow for a phone number. Attributes as in create/3.

Deletes a draft flow. This cannot be undone.

Deprecates a published flow.

Gets a flow. fields defaults to "id,name,status,categories,validation_errors,json_version,data_api_version,endpoint_uri,preview".

Lists the flow's assets, with download URLs for the flow JSON.

Lists the flows of a WhatsApp Business Account.

Lists the flows available to a phone number.

Publishes a flow. This cannot be undone.

Updates flow metadata: name, categories, endpoint_uri or application_id.

Uploads the flow JSON (max 10 MB). flow_json is a JSON string or a map, which is encoded for you.

Types

result()

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

Functions

create(client, business_account_id, attrs)

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

Creates a flow in a WhatsApp Business Account.

Attributes: name and categories (required), clone_flow_id, endpoint_uri, flow_json (a JSON string) and publish.

create_for_phone_number(client, phone_number_id, attrs)

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

Creates a flow for a phone number. Attributes as in create/3.

delete(client, flow_id, params \\ [])

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

Deletes a draft flow. This cannot be undone.

deprecate(client, flow_id, params \\ [])

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

Deprecates a published flow.

get(client, flow_id, params)

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

Gets a flow. fields defaults to "id,name,status,categories,validation_errors,json_version,data_api_version,endpoint_uri,preview".

Flows.get(client, flow_id, phone_number_id: "647015955153740")

get_assets(client, flow_id, params \\ [])

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

Lists the flow's assets, with download URLs for the flow JSON.

list(client, business_account_id, params \\ [])

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

Lists the flows of a WhatsApp Business Account.

list_for_phone_number(client, phone_number_id, params \\ [])

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

Lists the flows available to a phone number.

publish(client, flow_id, params \\ [])

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

Publishes a flow. This cannot be undone.

update(client, flow_id, attrs, params \\ [])

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

Updates flow metadata: name, categories, endpoint_uri or application_id.

upload_json(client, flow_id, flow_json, params \\ [])

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

Uploads the flow JSON (max 10 MB). flow_json is a JSON string or a map, which is encoded for you.