Use Box webhooks to attach event triggers to Box file/folder actions. Configure webhook to send Box events to AWS lambda and send custom email via Sendgrid.
- Change name of 'local.sample.js' file to 'local.js'
- Create Box JWT app, generate keys/credentials, update credentials in the local.js file
- Create a Sendgrid app, generate key, and add key to local.js file.
- Generate AWS Lambda
- Update 'targetFolderId' (Box folder you'd like to set the webhook on, must be a folder ID that the app's service account has access to) and 'notificationUrl' (AWS API Gateway 'API endpoint' url) variables in the create-webhook.js file
- Update 'targetEmail' variable in the index.js file to your desired target email.
- Install npm packages
$ npm install- Create Box webhook by running the command:
$ npm run create-webhook- Zip the project by running
$ npm run zip- Deploy to AWS (must have aws cli installed)
$ npm run deploy- Test it out! Upload file to target folder and receive email notification (assuming you did everything correctly :))