KapsoEx.Platform.Contacts (kapso_ex v0.1.0)

Copy Markdown View Source

WhatsApp contacts of the project.

identifier may be the contact's UUID, phone number (WhatsApp ID) or business-scoped user ID.

Summary

Functions

Creates a contact. Attributes: wa_id (required), profile_name, display_name, customer_id, metadata.

Permanently erases a contact and all its data (conversations, messages, media). This cannot be undone.

Gets a contact.

Gets the contact's marketing preference on one number.

Lists contacts.

Lists the contact's marketing preference on each of your numbers. An empty list means the contact never opted out.

Updates a contact's profile or metadata. Attributes as in create/2.

Types

result()

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

Functions

create(client, attrs)

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

Creates a contact. Attributes: wa_id (required), profile_name, display_name, customer_id, metadata.

erase(client, identifier)

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

Permanently erases a contact and all its data (conversations, messages, media). This cannot be undone.

get(client, identifier)

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

Gets a contact.

get_marketing_preference(client, identifier, phone_number_id)

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

Gets the contact's marketing preference on one number.

list(client, params \\ [])

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

Lists contacts.

Params: customer_id, customer_external_id, has_customer, profile_name_contains, wa_id_contains, business_scoped_user_id, created_after, created_before, and either page/per_page or limit/before/after. Use cursors for deep pagination.

list_marketing_preferences(client, identifier)

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

Lists the contact's marketing preference on each of your numbers. An empty list means the contact never opted out.

update(client, identifier, attrs)

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

Updates a contact's profile or metadata. Attributes as in create/2.