View Source ExPipedrive.CallLogs (ex_pipedrive v0.2.0)

API v1 client for Pipedrive call logs.

Call logs describe the outcome of a phone call managed by an integrated provider. They remain on /api/v1/callLogs; there is no /api/v2 equivalent yet, so every function here explicitly routes to api_version: :v1.

Pipedrive's call log API does not expose an update endpoint — only list/2, get/2, create/2, delete/2, and add_recording/3 (attach an audio file) are supported.

Unlike most Pipedrive entities, call log ids are Pipedrive-generated hex strings (e.g. "CAd92b224eb4a39b5ad8fea92ff0e"), not integers.

Example

{:ok, call_log} =
  ExPipedrive.CallLogs.create(client, %{
    to_phone_number: "+37249234343",
    outcome: "connected",
    start_time: "2022-12-12 01:01:01",
    end_time: "2022-12-12 01:02:01"
  })

{:ok, page} = ExPipedrive.CallLogs.list(client)
{:ok, call_log} = ExPipedrive.CallLogs.get(client, call_log.id)
{:ok, :ok} = ExPipedrive.CallLogs.add_recording(client, call_log.id, wav_bytes, "call.wav")
{:ok, :ok} = ExPipedrive.CallLogs.delete(client, call_log.id)

Summary

Functions

Attaches an audio recording to a call log via POST /api/v1/callLogs/:id/recordings (multipart/form-data).

Creates a call log via POST /api/v1/callLogs.

Deletes a call log via DELETE /api/v1/callLogs/:id.

Fetches a call log by id via GET /api/v1/callLogs/:id.

Lists call logs assigned to the authenticated user via GET /api/v1/callLogs.

Functions

Link to this function

add_recording(client, call_log_id, content, filename)

View Source
@spec add_recording(Tesla.Client.t(), String.t(), iodata(), String.t()) ::
  {:ok, :ok} | {:error, ExPipedrive.Error.t()}

Attaches an audio recording to a call log via POST /api/v1/callLogs/:id/recordings (multipart/form-data).

content is the audio file body; filename is sent as the multipart filename. Returns {:ok, :ok}.

@spec create(Tesla.Client.t(), map()) ::
  {:ok, ExPipedrive.CallLog.t()} | {:error, ExPipedrive.Error.t()}

Creates a call log via POST /api/v1/callLogs.

Requires :to_phone_number, :outcome (one of "connected", "no_answer", "left_message", "left_voicemail", "wrong_number", "busy"), :start_time, and :end_time. When :activity_id is given, that activity is converted into the call log and :deal_id, :person_id, :org_id are ignored in favor of the activity's own associations.

Returns {:ok, %CallLog{}}.

Link to this function

delete(client, call_log_id)

View Source
@spec delete(Tesla.Client.t(), String.t()) ::
  {:ok, :ok} | {:error, ExPipedrive.Error.t()}

Deletes a call log via DELETE /api/v1/callLogs/:id.

If an audio recording is attached, it is deleted along with the call log. The related activity, if any, is left untouched. Returns {:ok, :ok}.

Link to this function

get(client, call_log_id)

View Source
@spec get(Tesla.Client.t(), String.t()) ::
  {:ok, ExPipedrive.CallLog.t()} | {:error, ExPipedrive.Error.t()}

Fetches a call log by id via GET /api/v1/callLogs/:id.

Returns {:ok, %CallLog{}}.

Link to this function

list(client, opts \\ [])

View Source
@spec list(
  Tesla.Client.t(),
  keyword()
) :: {:ok, ExPipedrive.PagedResult.t()} | {:error, ExPipedrive.Error.t()}

Lists call logs assigned to the authenticated user via GET /api/v1/callLogs.

Options: :start (default 0), :limit (max 50).

Returns {:ok, %PagedResult{}}.