hero banner blog post

How to get started with Nylas using Postman

5 min read

The blog post focuses on Nylas API V2, our developer docs postman overview has been updated to work with Nylas API V3.

Intro

In this post let’s take a look at making Nylas API calls using Postman. Nylas offers a CLI, API, and SDKs to connect with your users’ communication data. We’ll explore using Postman to try out different Nylas APIs. Using Postman is a great approach when building out a new integration and learning the available endpoints. Alternatively, you can follow our video walking you through how to start using the Nylas Postman collection:

Prerequisites

  • Sign up here if you need to create a Nylas account for free!
    • Create a new App in the Nylas dashboard
  • We’ll be using Postman, web version, to make Nylas API calls, to be sure to signup for free

Environment

No local environment setup is required, we’ll be using the Nylas and Postman web tools to set everything up.

Retrieving Nylas Credentials

To setup Postman, we will need to share Nylas credentials for our application and for a connected user:

1. Retrieve the Nylas credentials from the Nylas Dashboard (Nylas Dashboard → Select the Quickstart Application —> App Settings):

2. You can connect a user via the dashboard:

Now you have retrieved the Nylas’ client_id, client_secret and user’s access_token. Now we’ve gone through accessing the Nylas credentials to make API calls using Postman.

Accessing Nylas’ Postman Collection

You can access the collection via the web, click here to access the online postman collection. The Nylas API collection on Postman contains all Nylas APIs documented, we are always working to keep Postman up-to date.

Consider forking the online collection if you want to make modifications or changes to the collection:

Now we’ve accessed the Nylas API Postman collection.

Setting up Environment Variables

You can access variables used throughout the Postman collection, with examples being credentials or Nylas’ API url. Let’s setup Postman to use the Nylas Production Template:

Now let’s make sure to update the Nylas credentials that we retrieved earlier by accessing the Environment variables:

Now we’ve updated the Postman Environment variables with all that we need to start using the Nylas API.

Making your first call with Postman

As a first API call, try calling the GET /account endpoint to retrieve the connected user’s account details:

You should see a response that looks like this:

Now we’ve successfully made our first Nylas API call with Postman.

Useful Postman features

Postman has many useful features when exploring and building out API integrations. One useful one to consider is the code snippet window that shows code snippets in different languages, here is an example of the GET /account call using cURL:

You can also complete scripts before and after a API call is made, here is an example of testing the response of an API call:

Postman has many useful features to explore, check out Postman’s Learning Center.

Now we’ve touched on a few useful features when building with Postman.

Reading and Sending Emails

Let’s consider the flow for reading and sending emails. Let’s try the read email API call via and limit the total emails by 1:

So by adding a limit of 1, we received the first email in our Inbox. Interestingly, its a blog post by Blag on reading emails using the Nylas SDKs!! Next let’s try sending an email:

Here we are using additional environment variables, name and exchange_email, so let’s modify those variables to be an email address we can access:

Since we confirmed the name as Nyla and the exchange_email as devrel@nylas.com, let’s test out sending an email:

And we can quickly check our email to see the received message:

Now we’ve explored reading and sending emails using Nylas on Postman.

Reading and Creating Calendar Events

Let’s consider the flow for reading and creating calendar events. Let’s try by first accessing calendars to retrieve a calendar id:

Next let’s update the calendar_id value in the Environment variables:

Next let’s retrieve the next 3 calendar events:

Let’s try creating a calendar event in the future, take note of the Pre-request Script tab:

We are using the Pre-request Script to create an event in the future that starts now and ends 30 minutes in the future. The script is run before the API call creating two environment variables (timestamp and timestamp2) to create a new event in the calendar:

Ensure you are using a calendar that has the read_only property as false or you may receive the response:

{
    "message": "Can't create events on read_only calendar.",
    "type": "invalid_request_error"
}

Now we’ve explored reading and creating calendar events using Nylas on Postman.

Reading & Creating Contacts

Let’s consider the flow for reading and creating contacts. Let’s try by first accessing contacts:

Before we can create a contact, we need to specify a contact group, let’s retrieve a contact group next:

Let’s try creating a contact, ensure to modify the group property in the post requests body:

Now we’ve explored reading and creating contacts events using Nylas on Postman.

Build Time

Continue building with Nylas and learn more by visiting the documentation. Sign up here if you need to create a Nylas account for free!

Related resources

How to create and read Google Webhooks using Ruby

Create and read your Google webhooks using Ruby and Sinatra, and publish them using Koyeb. Here’s the full guide.

Build mail merge and email templates using TinyMCE Rich Text Editor

Learn how to build Mail Merge and Email Template functionality in your email workflow using TinyMCE Rich Text Editor.

Send emails using TinyMCE Rich Text Editor

Learn how to improve your email workflow using TinyMCE Rich Text Editor.