The Nylas Ruby SDK v5.17.0 has been released!
- GitHub: Nylas Ruby SDK
- Distribution: RubyGems gem description
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, 9000NYLAS_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_jsonend
run Sinatra::Application.run!
New Contributors 🎉
This release wouldn’t have been possible without the hard work of our contributors!