Skip to content

PMK-2660 - Add missing webhook payload models (Click, SpamComplaint, SubscriptionChange) - #157

Merged
smunuswamiac merged 2 commits into
mainfrom
PMK-2660-webhook-payload-models
Jul 7, 2026
Merged

PMK-2660 - Add missing webhook payload models (Click, SpamComplaint, SubscriptionChange)#157
smunuswamiac merged 2 commits into
mainfrom
PMK-2660-webhook-payload-models

Conversation

@smunuswamiac

Copy link
Copy Markdown
Contributor

Summary

Adds type-safe webhook payload models for three documented Postmark webhook record types that the library was missing:

  • PostmarkClickWebhookMessage : PostmarkClick — adds ClickLocation, ReceivedAt, Tag, Recipient, Metadata. Closes PostmarkClickWebhookMessage not in Models #145 and supersedes the stalled Create PostmarkClickWebhookMessage #146 (that PR's file had no .cs extension, used tabs, had a copy-paste doc comment, and was missing ClickLocation).
  • PostmarkSpamComplaintWebhookMessage : PostmarkBounce — adds TypeCode, Content, Metadata, mirroring the existing PostmarkBounceWebhookMessage pattern.
  • PostmarkSubscriptionChangeWebhookMessage — standalone model.

Property casing is taken verbatim from the public Postmark webhook docs to match the case-sensitive System.Text.Json defaults consumers use.

Scope decision (deviates from the ticket)

The ticket (PMK-2660) also proposed a PostmarkSmtpApiErrorWebhookMessage and an SmtpApiError webhook-configuration trigger. Both were intentionally omitted — they are based on a misconception:

  • SMTP API Error is not a distinct webhook record type. It is delivered as a Bounce webhook with Type = SMTPApiError, which already exists as PostmarkBounceType.SMTPApiError (100007).
  • The webhook Triggers API supports only 6 triggers (Open, Click, Delivery, Bounce, SpamComplaint, SubscriptionChange) — all already modeled. PostmarkServer.EnableSmtpApiErrorHooks is a separate server-level setting, not a configuration trigger; adding a trigger property would send an unsupported field to the API.
  • The sibling postmark.js library models neither an SMTP API Error payload nor trigger, confirming the gap does not exist.

Testing

Adds WebhookMessageDeserializationTests deserializing the documented example payloads for all three models, including a subscription-change reactivation edge case (SuppressSending = false → null SuppressionReason/Tag, empty Metadata).

The test project targets netcoreapp3.1; models were additionally verified against the built library on a modern runtime (33/33 field assertions pass). Both projects build clean.

🤖 Generated with Claude Code

…SubscriptionChange)

The library had webhook payload models for only 4 of the documented webhook
record types. This adds type-safe models for three more:

- PostmarkClickWebhookMessage : PostmarkClick (adds ClickLocation, ReceivedAt,
  Tag, Recipient, Metadata) - supersedes stalled PR #146 / issue #145.
- PostmarkSpamComplaintWebhookMessage : PostmarkBounce (adds TypeCode, Content,
  Metadata) - mirrors the existing PostmarkBounceWebhookMessage pattern.
- PostmarkSubscriptionChangeWebhookMessage - standalone model.

Property casing was taken verbatim from the public Postmark webhook docs to
match the case-sensitive System.Text.Json defaults consumers use.

Scope note: the ticket also proposed a PostmarkSmtpApiErrorWebhookMessage and an
SmtpApiError webhook-configuration trigger. Both were intentionally omitted:
SMTP API Error is not a distinct webhook record type but a Bounce with
Type = SMTPApiError (already present as PostmarkBounceType.SMTPApiError), and the
webhook Triggers API supports only the six triggers already modeled. postmark.js
models neither, confirming the gap does not exist. EnableSmtpApiErrorHooks on
PostmarkServer is a separate server-level setting, not a config trigger.

Adds WebhookMessageDeserializationTests covering the documented example payloads,
including a subscription-change reactivation edge case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@ac-bgelfius ac-bgelfius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

- Bump <Version> to 5.4.1.
- Add a NuGet package README (PackageReadmeFile) so the published package no
  longer warns about a missing readme. The prior release (5.4.0) shipped with
  no <readme> element in its nuspec. Includes a "What's New" section covering
  the 5.4.1 webhook payload models and the 5.4.0 Bulk Email API.

Note: CI derives the published version from the git tag, so tagging 5.4.1 on
main is what triggers the NuGet publish; the csproj bump keeps local packs in
sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@ac-bgelfius ac-bgelfius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@smunuswamiac
smunuswamiac merged commit b4249c5 into main Jul 7, 2026
3 checks passed
@smunuswamiac
smunuswamiac deleted the PMK-2660-webhook-payload-models branch July 7, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostmarkClickWebhookMessage not in Models

2 participants