Repository navigation
🐛 Fixing verifyWebhook to return the payloads PDFMonkey actually sends - #21
Merged
Merged
Conversation
simonc
force-pushed
the
webhook-payloads
branch
from
October 5, 2026 21:53
42fb73e to
f6d3f4c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
verifyWebhook()rejected every real webhook. After the signature check passed, it required a{ type, data, timestamp }envelope, but the backend sends the body as-is (DocumentGenerations::WebhookBroadcastingJob,SendQuotaNotificationsJob):documents.generation.success/documents.generation.failure:{ "document": <document card JSON> }quota.warning:{ period_start, period_end, available_documents, threshold }The event names
document.done/document.errornever existed either.Changes
verifyWebhook()keeps the signature and timestamp checks, then returns the parsed body asWebhookPayload(DocumentWebhookPayload | QuotaWarningWebhookPayload). The only shape check left is that the body is a JSON object.DocumentWebhookPayload.documentreusesDocumentCard. The event type isn't in the body, so callers check'document' in payloadandpayload.document.status.WebhookEvent,WebhookEventType,DocumentDoneEvent(Data),DocumentErrorEvent(Data)andUnknownWebhookEvent. This is a minor bump: the types change, but the old shape never worked against the live API.Notes
CHANGELOG.md"Unreleased" andsrc/webhooks.ts, which ✨ Adding search and multi-status filters to documentCards.list #19 also edits. Whichever merges second needs a small rebase.Testing
pnpm test(212 passed),pnpm lint,tsc --noEmitandpnpm buildpass.