Giter VIP home page Giter VIP logo

data.management-nodejs-webhook's Introduction

data.management-nodejs-webhook

Node.js npm Platforms License

Forge API: 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 https://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 https://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 with SSL on https://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

data.management-nodejs-webhook's People

Contributors

augustogoncalves avatar golembiovskyi avatar apprentice3d avatar jaylimboonkiat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.