Karta.Webhooks.Postmark (Karta v1.0.0)

Webhook requests in Postmark's format, for receivers written for Postmark's webhooks: one JSON object per event, its kind in RecordType, with Postmark's fields in Postmark's order.

No signature. Postmark does not sign its webhooks; receivers protect them with a user name and password in the URL (Basic authentication, which Karta sends from the webhook's URL, over https only) and by checking the data. Webhooks in this format have no secret. Each request carries X-PM-Webhook-Trace-Id, the delivery's id: the same on every attempt and replay of one event to one webhook, as receivers use it to drop duplicates.

Record types, from Karta's event types:

  • message.delivered - Delivery;
  • message.bounced - Bounce of type HardBounce (1) when the server refused the message, SoftBounce (4096) when the retry period ran out;
  • message.deferred - Bounce of type Transient (2), "Message delayed/Undeliverable": Karta tries again;
  • message.opened - Open, FirstOpen true for the recipient's first open;
  • message.clicked - Click;
  • message.unsubscribed - SubscriptionChange: Origin Recipient, SuppressSending true, SuppressionReason ManualSuppression;
  • message.complained - SpamComplaint: Inactive true and CanActivate false, as Postmark marks an address a recipient complained about; Details is the report's user agent, and Content is "" (Karta keeps no report text).

message.accepted and message.suppressed have no record type (Postmark refuses a message to a suppressed address when it is sent), nor has domain.dns_failed.

MessageID is Karta's id of the message (one per message, whatever its number of recipients, as Postmark's), Recipient or Email the recipient's address, Tag the message's first tag ("" without one), Metadata its variables, MessageStream outbound. What Karta does not have is sent as Postmark sends what it does not know, or left out: ServerID (Postmark's servers are numbered, Karta's are not) and a bounce's ID (Postmark's are numbers, Karta's UUIDs, which typed receivers would not read; the bounce API has them) are left out; a bounce's Content is "" and DumpAvailable false (Karta keeps no bounce message), Inactive false and CanActivate true (a bounce does not put the address on the suppression list); Platform is Unknown, ReadSeconds 0, Client and OS have Unknown names, Geo has only IP, the client's network as Karta keeps it; ClickLocation is HTML (Karta tracks links in HTML only). webhook.test has RecordType webhook.test, WebhookID, Description and ReceivedAt.

Summary

Functions

The body of a request about event (a stored Karta.Webhooks.Event).

The headers of a request for the delivery id.

Karta's event types that have a Postmark record type.

Functions

body(event)

@spec body(map()) :: String.t()

The body of a request about event (a stored Karta.Webhooks.Event).

headers(id)

@spec headers(Ecto.UUID.t()) :: [{String.t(), String.t()}]

The headers of a request for the delivery id.

types()

@spec types() :: [String.t()]

Karta's event types that have a Postmark record type.