WebhookEndpoint
Popii / WebhookEndpoint
Interface: WebhookEndpoint
Section titled “Interface: WebhookEndpoint”Defined in: plugins/webhook.ts:14
Methods
Section titled “Methods”handle()
Section titled “handle()”handle(
payload,meta):void|Promise<void>
Defined in: plugins/webhook.ts:45
Called with the parsed JSON payload after successful verification.
Parameters
Section titled “Parameters”payload
Section titled “payload”any
Returns
Section titled “Returns”void | Promise<void>
Properties
Section titled “Properties”path:
string
Defined in: plugins/webhook.ts:16
URL path this endpoint listens on.
method?
Section titled “method?”
optionalmethod?:"GET"|"POST"|"PUT"|"PATCH"
Defined in: plugins/webhook.ts:18
HTTP method to accept. Defaults to “POST”.
rateLimit?
Section titled “rateLimit?”
optionalrateLimit?:object
Defined in: plugins/webhook.ts:23
Per-IP rate limit for this endpoint.
max:
number
windowMs
Section titled “windowMs”windowMs:
number
Example
Section titled “Example”rateLimit: { max: 10, windowMs: 60_000 } // 10 req/minsecret?
Section titled “secret?”
optionalsecret?:string
Defined in: plugins/webhook.ts:25
Shared secret used for HMAC verification.
algorithm?
Section titled “algorithm?”
optionalalgorithm?:"sha256"|"sha1"|"md5"
Defined in: plugins/webhook.ts:34
HMAC algorithm preset. Automatically reads the signature from the appropriate header and strips the common prefix:
- “sha256” → x-hub-signature-256, prefix “sha256=” (GitHub, Stripe, etc.)
- “sha1” → x-hub-signature, prefix “sha1=”
- “md5” → x-patreon-signature, no prefix (Patreon)
Ignored if
verifyis provided.
signatureHeader?
Section titled “signatureHeader?”
optionalsignatureHeader?:string
Defined in: plugins/webhook.ts:36
Override which header carries the signature.
signaturePrefix?
Section titled “signaturePrefix?”
optionalsignaturePrefix?:string
Defined in: plugins/webhook.ts:38
Prefix to strip from the signature header value before comparing.
verify?
Section titled “verify?”
optionalverify?: (body,headers,secret) =>boolean|Promise<boolean>
Defined in: plugins/webhook.ts:43
Custom verify function. Return false to reject with 401. Overrides algorithm/signatureHeader/signaturePrefix when provided.
Parameters
Section titled “Parameters”string
headers
Section titled “headers”Record<string, string>
secret
Section titled “secret”string
Returns
Section titled “Returns”boolean | Promise<boolean>