View Source ExPipedrive.Webhook.Event (ex_pipedrive v0.2.0)
A normalized Pipedrive webhook event.
from_payload/1 accepts:
- Webhooks v1 — top-level
"event"("updated.deal","added.organization", …) with"current"/"previous"bodies - Webhooks v2 —
"meta.action"+"meta.entity"with"data"/"previous"(no top-level event name; one is synthesized as"action.entity") - v2-ish aliases —
"event_type"/"event_name", and"resource.action"order ("person.updated")
Event type matrix
Actions
| API | Actions |
|---|---|
| v1 | added, updated, deleted, merged |
| v2 | create, change, delete |
| alias | created (treated like a first-class action token) |
Typed resources (decoded when a matching entity module exists)
| Resource key | Struct |
|---|---|
deal | ExPipedrive.Deal |
person | ExPipedrive.Person |
organization | ExPipedrive.Organization |
activity | ExPipedrive.Activity |
lead | ExPipedrive.Lead |
note | ExPipedrive.Note |
product | ExPipedrive.Product |
pipeline | ExPipedrive.Pipeline |
stage | ExPipedrive.Stage |
user | ExPipedrive.User |
activityType | ExPipedrive.ActivityType |
deal_product | ExPipedrive.DealProduct |
deal_installment | ExPipedrive.DealInstallment |
project | ExPipedrive.Project |
task | ExPipedrive.Task |
board | ExPipedrive.ProjectBoard |
Unknown resources (e.g. phase) keep current / previous as maps. The full
delivery is always available on :raw. Deletes typically have current: nil
and a populated previous (decoded when typed).
Event structs stay in core so API-only apps can decode webhook payloads
without Plug. Mount ExPipedriveWeb.Incoming.Handler from the optional
ex_pipedrive_web package to receive POSTs.
Summary
Functions
Normalizes a Pipedrive webhook payload into an event.
Resource keys that decode into entity structs.
Types
@type t() :: %ExPipedrive.Webhook.Event{ action: String.t() | nil, current: resource_payload(), diff: map(), meta: map(), name: String.t(), previous: resource_payload(), raw: map(), resource: String.t() | nil }
Functions
Normalizes a Pipedrive webhook payload into an event.
@spec typed_resources() :: [String.t()]
Resource keys that decode into entity structs.
Other resources remain maps on :current / :previous.