Version:
Only show these results:

[2023-04-04] Nylas Ruby SDK v5.17.0

The Nylas Ruby SDK v5.17.0 has been released!

This latest release of the Nylas Ruby SDK brings some helpful additions for webhooks, Events, and native authentication.

Added

  • Added support for verifying webhook signatures (#413)
  • Add event.updated_at (#410)
  • Allow native authentication to return the full response like the exchange_code_for_token (#411)

Verifying webhook signatures with the Nylas Ruby SDK

require 'sinatra'
require 'nylas'
require 'json'

set :port, 9000
NYLAS_CLIENT_SECRET = ENV['NYLAS_CLIENT_SECRET']

post '/' do
content_type :json
x_nylas_signature = request.env['HTTP_X_NYLAS_SIGNATURE']
raw_body = request.body.read

unless Nylas::Webhook::verify_webhook_signature(NYLAS_CLIENT_SECRET, x_nylas_signature, raw_body)
status 403
return { error: 'Invalid signature' }.to_json
end

body = JSON.parse(raw_body)
puts "Webhook event received: #{JSON.pretty_generate(body)}"

status 200
{ success: true }.to_json
end

run Sinatra::Application.run!

New Contributors 🎉

This release wouldn’t have been possible without the hard work of our contributors!

  • @tvongaza made their first contribution in #411 and followed it up with #412! Thanks for your contributions!