View Source ExPipedrive.Incoming.Handler (ex_pipedrive v0.1.0)

Plug router for incoming Pipedrive webhook POSTs.

Normalizes Pipedrive payloads into ExPipedrive.Webhook.Event structs and delivers them to an optional ExPipedrive.Webhook.Handler module. The host application owns fan-out (Registry, PubSub, etc.) — core does not start any OTP processes for webhooks.

Requires the optional plug dependency. Add to your app:

{:plug, ">= 1.16.0"}

Without plug, this module is not compiled. Payload transformers (ExPipedrive.Webhook.Event and ExPipedrive.Webhook.Handler) remain available without Plug. This is the in-repository ex_pipedrive_web surface, reserved for extraction as an optional package.

Example

forward "/webhooks", to: ExPipedrive.Incoming.Handler,
  init_opts: [handler: MyApp.PipedriveWebhookHandler,
              auth_fn: fn -> [username: "pipedrive", password: secret] end]

See https://pipedrive.readme.io/docs/guide-for-webhooks for event types and payload shapes. :auth_fn is optional; when present it can be a zero-arity function returning Plug.BasicAuth options or those options directly.

Compatibility

on_event: fn {:updated_deal, payload} -> ... end remains supported for deal and person update events. New integrations should configure :handler and implement ExPipedrive.Webhook.Handler.

Summary

Functions

Callback implementation for Plug.call/2.

Delivers a normalized webhook event to the configured handler.

Callback implementation for Plug.init/1.

Normalizes a Pipedrive webhook payload into an Event.

Functions

Callback implementation for Plug.call/2.

Link to this function

deliver_event(event, opts)

View Source

Delivers a normalized webhook event to the configured handler.

:handler is preferred. :on_event receives the historical tuple shape for deal/person update events when no handler is configured.

Callback implementation for Plug.init/1.

Link to this function

normalize_event(payload)

View Source
@spec normalize_event(map()) :: ExPipedrive.Webhook.Event.t() | nil

Normalizes a Pipedrive webhook payload into an Event.

Link to this function

transform_event(arg1, payload)

View Source