This sample application demonstrate Webhooks notifications for changes on BIM 360 Docs, BIM 360 Team (formerly A360) and Fusion 360 to SMS, Email and chat bot.
Usage: after sign in with your Autodesk account, (1) expand the tree to select a folder. Then (2), select the events to get notification. Finally, (3) enter a mobile phone number, and/or email address, and/or slack channel. Click on Create notification.
This samples requires Forge credentials, Twilio, Postmark & Slack accounts. Create the following environment variables:
For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app. For this new app, use
https://localhost:3000/api/forge/callback/oauth as Callback URL. Finally take note of the Client ID and Client Secret. For localhost testing:
- FORGE_CALLBACK_URL (optional on localhost)
Create a Twilio developer account. Create an phone number. Also, you will need the Account SID and Token. The following env vars are required:
Create a Postmark developer account. Specify the FROM email, verify it. Take note of your Account ID. The following env vars are required:
Make sure to have NodeJS installed. Clone this project or download it. It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):
git clone https://github.com/autodesk-forge/data.management-nodejs-webhook
Set all all environment variables described on the Setup section using the following:
- Mac OSX/Linux (Terminal)
- Windows (use Node.js command line from Start menu)
Install the required packaged and run the application:
npm install npm run dev
Open the browser with SSL on https://localhost:3000
Important: do not use npm start locally, this is intended for PRODUCTION only with HTTPS (SSL) secure cookies.
A deployment should have the following environment variables defined (e.g. Heroku app settings):
Deploy on Heroku
To deploy this application to Heroku, the Callback URL for Forge and Storage must use your
.herokuapp.com address. After clicking on the button below, at the Heroku Create New App page, set your Client ID, Secret and Callback URL for Forge and respective storage.
Watch this video on how deploy samples to Heroku.
BIM 360 Docs Hub names are comming with wrong formating, resulting in a wrong message. This issue is under investigation.
Tips & tricks
For local development/testing, consider use nodemon package, which auto restart your node application after any modification on your code. To install it, use:
sudo npm install -g nodemon
Then, instead of npm run dev, use the following:
npm run nodemon
Which executes nodemon server.js --ignore www/, where the --ignore parameter indicates that the app should not restart if files under www folder are modified.
After installing Github desktop for Windows, on the Git Shell, if you see a error setting certificate verify locations error, use the following:
git config --global http.sslverify "false"
Forge Partner Development Team
- Augusto Goncalves @augustomaia
See more at Forge blog.