Webhooks API v2 limitations is there a way around them
I have read the webhook documentation and am struggling to understand how I can implement webhooks for all the files/folders in an account. Basically I simply want notifications of any change to a file or folder such as rename, move, copy, delete, upload that would affect the name or path.
The problem is the limitations, it looks as if I have to create a webhook for every file or folder I want to monitor, and I am limited to 1000 webhooks. The limitations are clear that you cannot request a webhook on root and expect to receive notifications for anything below that. This does not look viable for an account with a reasonable number of files, for example 1500 folders and 6000 files would be completely impossible to monitor effectively if I reading the docs correctly.
Do you get notifications on files that are trashed, renamed, copied, moved or uploaded if you place a webhook on the parent folder?
Have I missed something or is this a known issue with the API?
Thanks for the reply, I want to confirm my understanding of your reply.
If I understand you correct you are suggesting that the V2 Box API allows you to set a webhook on a folder and receive notifications for changes to any children of that folder.
That implies if I put a webhook on each folder within the root folder I would receive notifications for any changes to any files or folders below them, is that correct?
There is a massive hole in this rather neat logic, if you are not allowed to put a webhook on the root folder how to you get notifications of any additions to the root folder contents, either new folders or files?
The documentation implies that you need to set a webhook on EVERY file and folder, it seems from what you replied above this is not true, so the documentation is very unclear and confusing, suggest it urgently needs an update.
I have added clarifications in-line below. Please let me know if you have follow-up questions?
"If I understand you correct you are suggesting that the V2 Box API allows you to set a webhook on a folder and receive notifications for changes to any children of that folder."
- That is correct. The only exception is setting up a webhook on the root folder. You can set up a webhook on any folder, and monitor that folder and its child folders.
"That implies if I put a webhook on each folder within the root folder I would receive notifications for any changes to any files or folders below them, is that correct?"
- That is correct. As you described, the workaround to not being able to set up a webhook on the root folder is to set up webhooks on the folders within the root folder. To further address this limitation, you can also set up webhooks on the files within the root folder.
"Also need to confirm if a webhook on a folder gets events for all items changed within that folder AND its subfolders."
- That is correct.
I updated our Webhooks V2 docs page based on everybody's feedback in this thread. Thanks for sharing these comments!
There are two options. The first approach is to create different Box applications for each of your environments. The second approach is to setup a gateway on your server where you listen for Box webhooks and then route them to the correct environment.
Thanks for the clarification
Please can you advise if there is a way to view all webhooks created rather than individually?
Ideally i would make a GET request to https://api.box.com/2.0/webhooks using my developer oauth bearer token for a complete list of all webhooks created under v2 on the account.