How to verify if the webhook is actually coming from Nylas (Webhook best practice)

Priyanka Gupta
Priyanka Gupta

Task

How to verify if a webhook notification is actually coming from Nylas? This can be done by verifying Nylas webhook signatures using the code snippet below. This code is written in Javascript.

 

Instructions

function verify_nylas_request(req) {
const digest = crypto
.createHmac('sha256', config.nylasClientSecret)
.update(req.rawBody)
.digest('hex');
return digest === req.get('x-nylas-signature');
}

 

Resources

A GitHub example on implementing webhooks

 

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.