KapsoEx.WhatsApp.Conversations (kapso_ex v0.1.0)

Copy Markdown View Source

Conversations stored by Kapso for a phone number, plus thread control on shared numbers.

For project-wide queries, assignments and status changes see KapsoEx.Platform.Conversations.

Summary

Functions

Lists conversations, latest activity first.

Passes, releases or takes a conversation between apps on a shared number.

Types

result()

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

Functions

get(client, phone_number_id, conversation_id, params \\ [])

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

Gets a conversation. Params: fields.

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

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

Lists conversations, latest activity first.

Params: status ("active"/"ended"), assigned_user_id, unassigned, last_active_since, last_active_until, phone_number, limit, before, after, fields.

thread_control(client, phone_number_id, to, action, opts \\ [])

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

Passes, releases or takes a conversation between apps on a shared number.

action is "pass", "release" or "take". to is a phone number or a map with :to / :recipient.

Options

  • :target_role - for "pass": "escalation", "ai_agent", "customer_service", "marketing", "utility" or "ctwa".
  • :metadata - string (up to 2000 chars) passed to the receiving app.

A 502 means the outcome is unknown; Kapso never retries it.

Conversations.thread_control(client, phone_number_id, "15551234567", "pass",
  target_role: "escalation", metadata: "Customer asked for a human")