Skip to content

This is a small repo on how to create webhooks-server for you Nylas applications in the cloud (Heroku)

Notifications You must be signed in to change notification settings

nylas/webhooks-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webhooks-server

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.

Initial setup

  • 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 git@github.com:nylas/webhooks-server.git

  • Get your Client Secret which you can find on you developer dashboard app settings you will need it later.

  • Screen Shot 2021-04-30 at 10 55 39

Deploy to Heroku app.

  • 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 your NYLAS_CLIENT_SECRET

  • Screen Shot 2021-05-07 at 10 37 19
  • 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 from webhooks-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 example https://your-heroku-app-name.herokuapp.com/webhook

🎉 Now track all your webhooks from Nylas Dashboard Webhook logs 🎉

Extras

  • 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.

Screen Shot 2021-05-07 at 10 39 48

About

This is a small repo on how to create webhooks-server for you Nylas applications in the cloud (Heroku)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published