A beta version of the new Box developer documentation site is launching soon! Updated Developer Guides, modern API Reference, and AI-powered search are on the way to help you build with Box faster. Stay tuned for more updates.
Creates a webhook.
"https://example.com/webhooks"The URL that is notified by this webhook.
The item that will trigger the webhook.
"1231232"The ID of the item to trigger a webhook.
"file"The type of item to trigger a webhook.
Value is one of file,folder
["FILE.UPLOADED"]An array of event names that this webhook is to be triggered for.
Returns the new webhook object.
Returns an error if the parameters were incorrect.
Returns an error if the application does not have the permission to manage webhooks.
Returns an error if the target item could not be found.
Returns an error if the a webhook for this combination of target, application, and user already exists.
An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/webhooks" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"target": {
"id": "21322",
"type": "file"
},
"address": "https://example.com/webhooks",
"triggers": [
"FILE.PREVIEWED"
]
}'await client.webhooks.createWebhook({
target: {
id: folder.id,
type: 'folder' as CreateWebhookRequestBodyTargetTypeField,
} satisfies CreateWebhookRequestBodyTargetField,
address: 'https://example.com/new-webhook',
triggers: ['FILE.UPLOADED' as CreateWebhookRequestBodyTriggersField],
} satisfies CreateWebhookRequestBody);client.webhooks.create_webhook(
CreateWebhookTarget(id=folder.id, type=CreateWebhookTargetTypeField.FOLDER),
"https://example.com/new-webhook",
[CreateWebhookTriggers.FILE_UPLOADED],
)await client.Webhooks.CreateWebhookAsync(requestBody: new CreateWebhookRequestBody(target: new CreateWebhookRequestBodyTargetField() { Id = folder.Id, Type = CreateWebhookRequestBodyTargetTypeField.Folder }, address: "https://example.com/new-webhook", triggers: Array.AsReadOnly(new [] {new StringEnum<CreateWebhookRequestBodyTriggersField>(CreateWebhookRequestBodyTriggersField.FileUploaded)})));try await client.webhooks.createWebhook(requestBody: CreateWebhookRequestBody(target: CreateWebhookRequestBodyTargetField(id: folder.id, type: CreateWebhookRequestBodyTargetTypeField.folder), address: "https://example.com/new-webhook", triggers: [CreateWebhookRequestBodyTriggersField.fileUploaded]))client.getWebhooks().createWebhook(new CreateWebhookRequestBody(new CreateWebhookRequestBodyTargetField.Builder().id(folder.getId()).type(CreateWebhookRequestBodyTargetTypeField.FOLDER).build(), "https://example.com/new-webhook", Arrays.asList(CreateWebhookRequestBodyTriggersField.FILE_UPLOADED)))await client.Webhooks.CreateWebhookAsync(requestBody: new CreateWebhookRequestBody(target: new CreateWebhookRequestBodyTargetField() { Id = folder.Id, Type = CreateWebhookRequestBodyTargetTypeField.Folder }, address: "https://example.com/new-webhook", triggers: Array.AsReadOnly(new [] {new StringEnum<CreateWebhookRequestBodyTriggersField>(CreateWebhookRequestBodyTriggersField.FileUploaded)})));await client.webhooks.createWebhook({
target: {
id: folder.id,
type: 'folder' as CreateWebhookRequestBodyTargetTypeField,
} satisfies CreateWebhookRequestBodyTargetField,
address: 'https://example.com/new-webhook',
triggers: ['FILE.UPLOADED' as CreateWebhookRequestBodyTriggersField],
} satisfies CreateWebhookRequestBody);{
"id": "11446498",
"type": "webhook",
"address": "https://example.com/webhooks",
"created_at": "2012-12-12T10:53:43-08:00",
"created_by": {
"id": "11446498",
"type": "user",
"login": "ceo@example.com",
"name": "Aaron Levie"
},
"target": {
"id": "1231232",
"type": "file"
},
"triggers": [
"FILE.UPLOADED"
]
}