This sample repo will show you how to easily deplay a serverless function endpoint to Vercel to work with Nylas webhooks using Node.js.
- N/A (serverless function to be deployed)
- N/A
- N/A
The endpoints available are
The GET endpoint method is required to handle the challenge parmeter to enable a webhook. So anytime we create a Nylas webhook, the callback_url that you deploy will be called before a webhook can be enabled.
Ensure the serverless function is deployed before creating a webhook. You can easily create a webhook for your app on the Nylas dashboard.
The POST endpoint method is where all delta messages will be sent when a webhook is triggered, such as a message being updated (i.e. when a message.update webhook triggered exists)
Run the serverless function as follows:
- fork this repository
- goto https://vercel.com/new
Importrepository- (optional) update project name
- press
Deployand make note of the deployed url (this will be thecallback_url) - create webhook via Nylas Dashboard, say
message.updated, ensure to add the deployed url (callback_url) - trigger webhook by starring a message (here is a list of
message.updatedtriggers)
Visit our Nylas documentation to learn more.