GitHub - IntuitDeveloper/SampleApp-WebhookNotifications-nodejs: A sample NodeJs application to demonstrate Webhooks and capture the notifications into a (csv) format file. This demo includes OAuth2.0
Repository navigation
SampleApp-WebhookNotifications-nodejsPublic
About
A sample NodeJs application to demonstrate Webhooks and capture the notifications into a (csv) format file. This demo includes OAuth2.0
Topics
inuitwebhooks nodejs webhookResources
Readme Apache-2.0 license Activity Custom propertiesStars
28 starsWatchers
2 watchingForks
21 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
22 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| views | views | ||
| .gitignore | .gitignore | ||
| LICENSE | LICENSE | ||
| NOTICE | NOTICE | ||
| README.md | README.md | ||
| app.js | app.js | ||
| package.json | package.json | ||
| sample-config.json | sample-config.json | ||
Repository files navigation
Intuit-WebhookNotifications-Demo in Javascript with Express
Overview
This is a quick OAuth2.0 incorporated demo that runs using JavaScript, Node.js and Express with the
node-quickbooks SDK
This sample app is meant to showcase an example of how to integrate your app with the Intuit Developer Platform. It showcases the following:
- Authorize into the app via OAuth2.0 ( Ref to OAuth2.0 for server side web-apps for more information )
- Create a sample customer
- Receive webhook notifications
- Write the notifications to a CSV file
Installation
Via Github Repo (Recommended)
$ git clone https://github.com/IntuitDeveloper/SampleApp-WebhookNotifications-nodejs $ cd SampleApp-WebhookNotifications-nodejs $ npm install
Configuration
Copy the contents from sample-config.json to config.json:
$ cp sample-confog.json config.json
Edit the config.json file to add your:
- clientId: You can find your
clientIdfrom theKeystab under yourApplisted on the developer portal - clientSecret: You can find your
clientSecretfrom theKeystab under yourApp - redirectUri: The
redirectUrifor your app ( OAuth2.0 ) - webhookUri: You can find your
webhookUrifrom theWebhookstab under yourApp - webhooksVerifier: copy the
show tokenfrom theWebhookstab under yourApp
In the Developer Portal , ensure the redirect URI in your config.json file has been entered in your app configuration. By default, the URL is set to the following for this demo:
Some properties of note:
| Property | Description |
|---|---|
redirectUri |
This is the OAuth 2.0 redirect URL, this will end in /call and be something like http://localhost:3000/callback or https://755c8b38.ngrok.io/callback. This needs to be configured in your app in the Developer Portal(https://developer.intuit.com ) |
webhookUri |
This is the webhook URL which ends in /webhook and can be something like https://yourdomain.com/webhook or https://755c8b38.ngrok.io/hook. |
TLS / SSL
Webhooks requires your enpoint to be exposed over the internet. The easiest way to do that while you are still developing your code locally is to use ngrok .
Here are the steps to configure ngrok
- Download and install ngrok
- Expose your localhost by running "ngrok http 3000" on the command line.
- You will then get a forwarding url that looks something like this: Forwarding https://755c8b38.ngrok.io -> localhost:3000
This will expose localhost:3000 to the Internet. Your endpoint url will now be https://755c8b38.ngrok.io/webhooks Copy this url and use it for setting up webhooks on Intuit Developer Portal for your app.
Usage
Start Node.js
$ npm start
Start ngrok (if you are using ngrok )
$ ngrok http 3000
Go to the URL (you must start ngrok if using it):
https://755c8b38.ngrok.io/
Then click the button to authorize the demo app and view the access token.
Events are logged to the Node.js console.
About
A sample NodeJs application to demonstrate Webhooks and capture the notifications into a (csv) format file. This demo includes OAuth2.0