- List all webhooks
- Create webhook
- Get webhook
- Update webhook
- Remove webhook
- Validate a webhook message
Returns all defined webhooks for the requesting application.
This API only returns webhooks that are applied to files or folders that are owned by the authenticated user. This means that an admin can not see webhooks created by a service account unless the admin has access to those folders, and vice versa.
This operation is performed by calling function get_webhooks
.
See the endpoint docs at API Reference.
client.webhooks.get_webhooks()
- marker
Optional[str]
- Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires
usemarker
to be set totrue
.
- Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires
- limit
Optional[int]
- The maximum number of items to return per page.
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type Webhooks
.
Returns a list of webhooks.
Creates a webhook.
This operation is performed by calling function create_webhook
.
See the endpoint docs at API Reference.
client.webhooks.create_webhook(
CreateWebhookTarget(id=folder.id, type=CreateWebhookTargetTypeField.FOLDER),
"https://example.com/new-webhook",
[CreateWebhookTriggers.FILE_UPLOADED],
)
- target
CreateWebhookTarget
- The item that will trigger the webhook
- address
str
- The URL that is notified by this webhook
- triggers
List[CreateWebhookTriggers]
- An array of event names that this webhook is to be triggered for
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type Webhook
.
Returns the new webhook object.
Retrieves a specific webhook
This operation is performed by calling function get_webhook_by_id
.
See the endpoint docs at API Reference.
client.webhooks.get_webhook_by_id(webhook.id)
- webhook_id
str
- The ID of the webhook. Example: "3321123"
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type Webhook
.
Returns a webhook object
Updates a webhook.
This operation is performed by calling function update_webhook_by_id
.
See the endpoint docs at API Reference.
client.webhooks.update_webhook_by_id(
webhook.id, address="https://example.com/updated-webhook"
)
- webhook_id
str
- The ID of the webhook. Example: "3321123"
- target
Optional[UpdateWebhookByIdTarget]
- The item that will trigger the webhook
- address
Optional[str]
- The URL that is notified by this webhook
- triggers
Optional[List[UpdateWebhookByIdTriggers]]
- An array of event names that this webhook is to be triggered for
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type Webhook
.
Returns the new webhook object.
Deletes a webhook.
This operation is performed by calling function delete_webhook_by_id
.
See the endpoint docs at API Reference.
client.webhooks.delete_webhook_by_id(webhook.id)
- webhook_id
str
- The ID of the webhook. Example: "3321123"
- extra_headers
Optional[Dict[str, Optional[str]]]
- Extra headers that will be included in the HTTP request.
This function returns a value of type None
.
An empty response will be returned when the webhook was successfully deleted.
Validate a webhook message by verifying the signature and the delivery timestamp
This operation is performed by calling function validate_message
.
WebhooksManager.validate_message(
body, headers_with_correct_datetime, primary_key, secondary_key=secondary_key
)
- body
str
- The request body of the webhook message
- headers
Dict[str, str]
- The headers of the webhook message
- primary_key
str
- The primary signature to verify the message with
- secondary_key
Optional[str]
- The secondary signature to verify the message with
- max_age
Optional[int]
- The maximum age of the message in seconds, defaults to 10 minutes
This function returns a value of type bool
.