Class: WebhookClient
Defined in: rest/v2/webhooks/client.ts:40
Constructors
Constructor
new WebhookClient(
oauth):WebhookClient
Defined in: rest/v2/webhooks/client.ts:65
Parameters
oauth
PatreonOauthClient
Returns
WebhookClient
Properties
oauth
oauth:
PatreonOauthClient
Defined in: rest/v2/webhooks/client.ts:66
payloads
payloads: typeof
WebhookPayloadClient=WebhookPayloadClient
Defined in: rest/v2/webhooks/client.ts:63
headers
staticheaders:object
Defined in: rest/v2/webhooks/client.ts:48
The headers that are sent on webhook requests
event
readonlyevent:"X-Patreon-Event"='X-Patreon-Event'
signature
readonlysignature:"X-Patreon-Signature"='X-Patreon-Signature'
Methods
createWebhook()
createWebhook(
webhook,options?):Promise<WriteResourceResponse<Webhook>>
Defined in: rest/v2/webhooks/client.ts:75
Creates a new webhook owned by this client.
Parameters
webhook
The webhook data: uri, event triggers and the campaign of the events
options?
Request options
Returns
Promise<WriteResourceResponse<Webhook>>
the API response from Patreon: either the created webhook on success or undefined when failed.
deleteWebhook()
deleteWebhook(
webhookId,options?):Promise<void>
Defined in: rest/v2/webhooks/client.ts:158
EXPERIMENTAL: This endpoint is not documented on https://docs.patreon.com but it should work
Issue a bug if something is broken
Delete a webhook created by this client
Parameters
webhookId
string
The webhook id
options?
Request options
Returns
Promise<void>
the webhooks managed by this client
editWebhook()
editWebhook(
webhook,options?):Promise<WriteResourceResponse<Webhook>>
Defined in: rest/v2/webhooks/client.ts:124
Edit the webhook, created by this client, attributes
Parameters
webhook
The data to edit
options?
Request options
Returns
Promise<WriteResourceResponse<Webhook>>
The updated webhook or undefined when failed to update
fetchWebhooks()
fetchWebhooks<
Query>(query,options?):Promise<GetResponsePayload<Query>>
Defined in: rest/v2/webhooks/client.ts:111
Fetch webhooks created by this client
Type Parameters
Query
Query extends BasePatreonQueryType<Webhook, true>
Parameters
query
Query
The query to fetch attributes and relationships
options?
Request options
Returns
Promise<GetResponsePayload<Query>>
the webhooks managed by this client
hasUnsentEvents()
hasUnsentEvents(
webhook):boolean
Defined in: rest/v2/webhooks/client.ts:175
Check if the webhook should be unpaused as events have failed to send.
If true, you can call unpauseWebhook.
Parameters
webhook
The webhook to check for unsent events
Returns
boolean
whether the webhook has failed events that can be resent
pauseWebhook()
pauseWebhook(
webhookId,options?):Promise<WriteResourceResponse<Webhook>>
Defined in: rest/v2/webhooks/client.ts:185
To temporarily pause events, such as when updating servers or deploying a new version.
Parameters
webhookId
string
The webhook to pause events for
options?
Request options
Returns
Promise<WriteResourceResponse<Webhook>>
the updated (paused) webhook
unpauseWebhook()
unpauseWebhook(
webhookId,options?):Promise<WriteResourceResponse<Webhook>>
Defined in: rest/v2/webhooks/client.ts:201
Continue sending events to this webhook.
Parameters
webhookId
string
The webhook to unpause events for
options?
Request options
Returns
Promise<WriteResourceResponse<Webhook>>
the updated (unpaused) webhook
getWebhookHeaders()
staticgetWebhookHeaders(headers):Record<"signature"|"event",null|string>
Defined in: rest/v2/webhooks/client.ts:53
Parameters
headers
Returns
Record<"signature" | "event", null | string>