[til] Add a webhook to Box.com folder

How to add a new webhook to Box.com folder using Box cli

I’m using box cli version for Mac OS.

Install Box cli

Document https://developer.box.com/en/guides/tooling/sdks/cli/

Add Box cli environment

$ box configure:environments:add ~/workspace/credentials/box_config.json --name test
Successfully added CLI environment "test"
$ box configure:environments:get test

Add webhook

Please get folder ID from your web browser URL https://app.box.com/folder/97520xxxxxx

$ FOLDER=97520xxxxxx && box webhooks:create folder $FOLDER --triggers=FILE.UPLOADED --address=https://YOUR-WEBHOOK_ENDPOINT
ID: '2583xxxxxx'
Type: webhook
Target:
    ID: '97520xxxxxx'
    Type: folder

Teardown

Remove webhook, remove Box environment

box webhooks:delete 2583xxxxxx
box configure:environments:delete test

Reference: https://developer.box.com/en/guides/webhooks/