The Nylas Communications Platform allows developers to quickly build features that connect to every inbox, calendar, and contacts book in the world. The Nylas SDKs are the quickest way to integrate the Nylas Email, Calendar, and Contacts APIs into your app.
This guide will help you get started with the Nylas Ruby SDK.
Setup your developer account first!
- CLIENT_ID - The CLIENT ID found on the dashboard page for your Nylas App
- CLIENT_SECRET - The CLIENT SECRET found on the dashboard page for your Nylas App
- ACCESS_TOKEN - The Access token that is provided when you authenticate an account to your Nylas App
- Ruby 2.3 or above.
- Ruby Frameworks:
We support Rails 4.2 and above. A more detailed compatibility list can be found in our list of Gemfiles.
Add this line to your application's Gemfile:
And then execute:
To run scripts that use the Nylas Ruby SDK, install the nylas gem.
gem install nylas
Apple stopped bundling OpenSSL with MacOS 10.11. However, one of the dependencies of this gem (EventMachine) requires it. If you're on El Capitan and are unable to install the gem, try running the following commands in a terminal:
sudo brew install openssl sudo brew link openssl --force gem install nylas
Every resource (i.e. messages, events, contacts, etc.) is accessed via an instance of
Nylas::API. Before making any requests, call
new and initialize the Nylas instance with your
CLIENT_SECRET. Then, call
.authenticate followed by
.as and pass it your
ACCESS_TOKEN. The access token allows Nylas to make requests for a given email account's resources.
The following example demonstrates how to setup the Nylas client object and print the subject line of the most recent email message.
nylas = Nylas::API.new(app_id: ENV['CLIENT_ID'], app_secret: ENV['CLIENT_SECRET']) nylas_user = nylas.as('ACCESS_TOKEN') puts(nylas_user.messages.first.subject)
Take a look at our code examples page to learn more about how to use the Nylas Ruby SDK.
How Nylas Works - Take a look at the Nylas architecture to see how we sync billions of emails.
Tutorials - Check out our plethora of tutorials to learn how to carry out common functionality, like sending emails, reading data from an email inbox, accessing file attachments, and organizing inboxes with labels and folders.
Integration Guides - Ready to start building your integration? Our integration guides cover what it takes to incorporate email functionality into your app. They cover best practices for using the Nylas Communications Platform and provider-specific advice for Google, Microsoft, and more.
Set up Postman - Postman makes it easy to explore the Nylas Email API.
API Reference - Our API reference provides all the detail you need to know to use the Nylas Communications Platform.