This simple express app is inspired from the example repo of nylas-nodejs/example/webhook I made some changes as using async await syntax, error handling using try catch, folder structures, before we used to run server locally and now we are making use of heroku to make it run in the cloud (Heroku).
This app correctly responds to Nylas challenge request when you add a webhook url to the developer dashboard. It also verifies any webhook notification POST requests by Nylas. The aim of this repo is to be able to create a callback URL for your Nylas application to log webhook notification using heroku app.
Make sure node
and npm
are installed on your computer.
-
Go to your local folder where you want to save this repo
-
Clone this repo on your computer locally using the below command
-
git clone [email protected]:nylas/webhooks-server.git
-
Get your Client Secret which you can find on you developer dashboard app settings you will need it later.
-
Create a heroku account here Heroku signup if you don't have one.
-
Create a new app in your Heroku, set App name and choose your region.
-
Go to heroku app settings click on
Reveal Config Vars
and set up yourNYLAS_CLIENT_SECRET
-
Go to your folder locally and install heroku CLI Install Heroku CLI.
-
Login to heroku from your terminal with
heroku login
-
Add heroku remote with
heroku git:remote -a your-heroku-app-name
, make sure you are running the command fromwebhooks-server
folder locally. -
Build using
git push heroku master
-
You will see url as
https://your-heroku-app-name.herokuapp.com/
copy it. -
Go to your developer dashboard and set your heroku url ending with
/webhook
as a Callback URL. -
Make sure you include
/webhook
in your callback Url examplehttps://your-heroku-app-name.herokuapp.com/webhook
🎉 Now track all your webhooks from Nylas Dashboard Webhook logs 🎉
- If you want to see your deltas object use the below command from the terminal
heroku logs --tail
Now you will be able to see the deltas object locally.