KapsoEx.Platform.Conversations (kapso_ex v0.1.0)

Copy Markdown View Source

Query conversations across the project, close or reopen them, and assign them to team members.

Summary

Functions

Assigns a conversation to a team member. Attributes: user_id (required), notes. Only one active assignment is allowed.

Gets a conversation.

Lists conversations, latest activity first, with cursor pagination.

Lists a conversation's assignments, most recent first. Params: page, per_page.

Updates an assignment: change notes, reassign with user_id, or unassign with active: false.

Closes ("ended") or reopens ("active") a conversation.

Types

result()

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

Functions

create_assignment(client, conversation_id, attrs)

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

Assigns a conversation to a team member. Attributes: user_id (required), notes. Only one active assignment is allowed.

get(client, conversation_id)

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

Gets a conversation.

get_assignment(client, conversation_id, assignment_id)

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

Gets an assignment.

list(client, params \\ [])

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

Lists conversations, latest activity first, with cursor pagination.

Params: phone_number_id, phone_number, status, assigned_user_id, unassigned, created_after, created_before, last_active_after, last_active_before, limit, before, after.

list_assignments(client, conversation_id, params \\ [])

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

Lists a conversation's assignments, most recent first. Params: page, per_page.

update_assignment(client, conversation_id, assignment_id, attrs)

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

Updates an assignment: change notes, reassign with user_id, or unassign with active: false.

update_status(client, conversation_id, status)

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

Closes ("ended") or reopens ("active") a conversation.