View Source ExPipedrive.Webhooks (ex_pipedrive v0.1.0)

Manages outgoing Pipedrive webhook subscriptions through API v1.

Pipedrive's webhook-management endpoints remain under /api/v1/webhooks; the webhook delivery format defaults to v2.0 when :version is omitted. This module manages subscriptions, while ExPipedrive.Webhook.* and ExPipedrive.Incoming.* handle webhook payloads received by your app.

Authorization

OAuth applications need webhooks:read to list subscriptions and webhooks:full to create or delete them. API tokens use the permissions of their owning user. Regular users can manage only their own subscriptions and events visible to that user; use a top-level admin user's token or user_id when a subscription must cover all company events.

Example

{:ok, subscription} =
  ExPipedrive.Webhooks.create(client, %{
    subscription_url: "https://example.com/pipedrive/webhooks",
    event_action: "change",
    event_object: "deal",
    name: "Deal changes"
  })

{:ok, subscriptions} = ExPipedrive.Webhooks.list(client)
{:ok, :ok} = ExPipedrive.Webhooks.delete(client, subscription.id)

Summary

Functions

Creates an outgoing webhook subscription via POST /api/v1/webhooks.

Deletes an outgoing webhook subscription via DELETE /api/v1/webhooks/:id.

Lists the webhook subscriptions visible to the authenticated user via GET /api/v1/webhooks.

Functions

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

Creates an outgoing webhook subscription via POST /api/v1/webhooks.

:subscription_url, :event_action, and :event_object are required by Pipedrive. :version accepts "1.0" or "2.0"; Pipedrive defaults it to "2.0" when omitted.

Returns {:ok, %Subscription{}}.

Link to this function

delete(client, subscription_id)

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

Deletes an outgoing webhook subscription via DELETE /api/v1/webhooks/:id.

Returns {:ok, :ok}.

@spec list(Tesla.Client.t()) ::
  {:ok, [ExPipedrive.Webhooks.Subscription.t()]}
  | {:error, ExPipedrive.Error.t()}

Lists the webhook subscriptions visible to the authenticated user via GET /api/v1/webhooks.

Returns {:ok, [%Subscription{}]}.