This API requires the application to have the Manage Webhooks scope enabled.
To attach a webhook to a folder, call the endpoint with the
type of folder, the ID of the folder, a URL to send webhook notifications to,
and a list of .
// Listen for preview events for a fileBoxFile file = new BoxFile(api, id);BoxWebHook.Info webhookInfo = BoxWebHook.create(file, url, BoxWebHook.Trigger.FILE.PREVIEWED);
file = client.file(file_id='12345')webhook = client.create_webhook(file, ['FILE.PREVIEWED'], 'https://example.com')print(f'Webhook ID is {webhook.id} and the address is {webhook.address}')
var webhookParams = new BoxWebhookRequest(){ Target = new BoxRequestEntity() { Type = BoxType.file, Id = "22222" }, Triggers = new List<string>() { "FILE.PREVIEWED" }, Address = "https://example.com/webhook"};BoxWebhook webhook = await client.WebhooksManager.CreateWebhookAsync(webhookParams);
It is best practice and strongly recommended to create webhooks with a
, or user that will not be deleted, to avoid potential
issues with webhook delivery due to loss of access to content.Similar to files and folders, webhooks are owned by a user. If a user who owns a
webhook is deleted, they will lose access to all files and folders that they
previously had access to. Their webhooks will begin to fail validation, but the
webhook service will continue to send events and require retries.
The notification URL specified in the address parameter must be a valid URL
that you specify when you create a webhook. Every time one of the triggers is
activated, this URL is called.The notification URL must use standard port 443 and should return
an HTTP status in the range of 200 to 299 within 30 seconds of receiving
the webhook payload.
The triggers are a list of strings that specify the events which cause the
webhook to fire. For example, if you want the webhook to be triggered
when a user uploads a file, use FILE.UPLOADED.You can find a list of available triggers .