Nylas Docs

The Nylas Developer Hub

Welcome to the Nylas developer hub. You'll find comprehensive guides and documentation to help you start working with Nylas as quickly as possible, as well as support if you get stuck. Let's jump right in!

Developer Guide

Ruby SDK

The Nylas Ruby SDK Quickstart Guide

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!

Before following this guide, sign up for a Nylas developer account, and follow our guide to get your developer API keys.

Create Your Developer Account

Before you install the SDK, sign up for a Nylas developer account, and follow our guide to get your developer API keys. You will need three values from this guide to run the code examples found here:

  • 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

Install the Nylas Ruby SDK

Prerequisites

  • Ruby 2.3 or above.
  • Ruby Frameworks: rest-client, json, yajl-ruby, em-http-request.

We support Rails 4.2 and above. A more detailed compatibility list can be found in our list of Gemfiles.

Install

Add this line to your application's Gemfile:

gem 'nylas'

And then execute:

bundle

To run scripts that use the Nylas Ruby SDK, install the nylas gem.

gem install nylas

MacOS 10.11 (El Capitan) Note

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

Quickstart Code Examples

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_ID and 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.

Next Steps

How Nylas Works - Take a look at the Nylas architecture to see how we sync billions of emails.

Quickstart Guides - Get up to speed quickly with our SDKs using our quickstart guides for Python and Node.js, or explore the Nylas Email, Calendar, and Contacts APIs.

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.

Ruby SDK


The Nylas Ruby SDK Quickstart Guide

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.