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.) — this package does not
start any OTP processes for webhooks.
Example
forward "/webhooks", to: ExPipedriveWeb.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.
ExPipedrive.Incoming.Handler is a compatibility alias for this module.
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.
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.
@spec normalize_event(map()) :: ExPipedrive.Webhook.Event.t() | nil
Normalizes a Pipedrive webhook payload into an Event.