Skip to content

Autodesk-Forge/forge-bim360notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get notifications (SMS/Email/Slack) for new folders and files

Node.js npm Platforms License

Viewer OAuth2 Data-Management Webhooks

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.

Thumbnail

thumbnail

Live version

Running live here and video demonstration here.

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.

Setup

Prerequisites

This samples requires:

  1. Forge credentials;
  2. Twilio account;
  3. Postmark account;
  4. Slack account.

Create the following environment variables:

Forge

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 http://localhost:3000/api/forge/callback/oauth as Callback URL. Finally take note of the Client ID and Client Secret. For localhost testing:

  • FORGE_CLIENT_ID and set it to above-mentioned Client ID
  • FORGE_CLIENT_SECRET and set it to above-mentioned Client Secret
  • FORGE_CALLBACK_URL and set it to http://localhost:3000/api/forge/callback/oauth

Now you need a local server to receive Webhook notifications, you can use ngrok as described here, then create a env var with the value (e.g. https://abc123.ngrok.io`)

  • FORGE_WEBHOOK_URL

Twilio

Create a Twilio developer account. Create an phone number. Also, you will need the Account SID and Token. The following env vars are required:

  • TWILIO_ACCOUNT_SID
  • TWILIO_TOKEN
  • TWILIO_FROM_NUMBER

Postmark

Create a Postmark developer account. Specify the FROM email, verify it. Take note of your Account ID. The following env vars are required:

  • POSTMARK_ACCOUNT_ID
  • POSTMARK_FROM_EMAIL

Slack

Create an app for Slack API on your company account to handle Incoming webhooks see more here. At the UI, enter the value in the form of T00000000/B00000000/XXXXXXXXXXXXXXXX

Running locally

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)
export VARIABLE_NAME=value
  • Windows (use Node.js command line from Start menu)
set VARIABLE_NAME=value

Install the required packaged and run the application:

npm install
npm run dev

Open the browser and go to http://localhost:3000.

Important: do not use npm start locally, this is intended for PRODUCTION only with HTTPS (SSL) secure cookies.

Deployment

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.

Deploy

Watch this video on how deploy samples to Heroku.

Known issues

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.

Troubleshooting

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"

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Augusto Goncalves @augustomaia, Forge Partner Development

Updated By