Automate Your Way to Inbox Zero With the Nylas Email API

Automate Your Way to Inbox Zero With the Nylas Email API

6 min read
    Tags:

    If you’re building an app that needs to incorporate email functionality and keep information updated in real-time, there’s a good chance you’ve investigated direct IMAP integrations and the overwhelming number of email API offerings from the likes of Gmail, Exchange, Office 365, Outlook, and more. They each have their own unique methods for integrating, so you might be asking yourself where to get started. Even once you’ve sorted through the chaotic protocols and behemoth APIs, it takes on average 30,000 hours and over $2M to build out a connection to all the major providers.

    Nylas provides a single point of integration that connects your app to every email provider in the world, and lets you add full email data and functionality to your app. You can build a full integration faster and at a fraction of the cost with the Nylas Email API vs. direct integrations with email service providers.

    Introducing Inbox Zero

    Inbox Zero is a sample app we’ve put together to demonstrate how to implement your first email functionality with the Nylas Communications Platform. With this demo, you can start adding email functionality to your app in minutes. Let’s take a look!

    The Inbox Zero Homepage

    Connect 100% of Email Accounts With Nylas Hosted Auth

    Nylas Hosted Auth provides a simple interface that takes care of the complexities related to auto-detecting service providers and negotiating and maintaining access to third-party services. This lets you authenticate 100% of email accounts to your app with a single point of integration. Inbox Zero demonstrates Nylas Hosted Auth via the app’s login functionality:

    Nylas Hosted Auth with Inbox Zero

    Read the Guide: Instantly Connect 100% of Email Accounts With Nylas Hosted Auth.

    Build Threaded Email Inbox Views

    The Nylas Email API Threads and Messages endpoints make it easy to organize the content of an email inbox by conversation, enabling you to build threaded inbox views that let user’s easily navigate their email inbox and find content that is filtered to fit the relevant context. Inbox Zero filters emails by their unread status, but you can also filter by sender, recipient, subject, body, and more:

    Threaded Inbox View with Inbox Zero

    Implement Full Email Draft and Send Functionality

    The Nylas Send endpoint sends emails directly from the end user’s email account; this lets your app leverage the reputation of your users’ email service providers. In other words, emails sent via the Nylas Email API are functionally equivalent to the user logging into their email account and sending the email themselves. This results in drastically better deliverability results than other common Email APIs, and makes your email integration much more reliable. Inbox Zero shows you how to add full email draft and send functionality:

    Draft and send emails with Inbox Zero

    Read the guide: Build Complete Email Draft & Send Functionality with Nylas

    Add Inbox Management Functionality

    The Nylas Email API Labels and Folders endpoints enable you to build full inbox management functionality to help users better organize their email. Coupled with inbox management functionality provided via other Nylas endpoints, you’re able to star important emails, mark them as read, add them to folders, apply labels, and more. Inbox Zero shows you how to add label management functionality and change the unread status of emails:

    Manage Emails with Inbox Zero

    Add Advanced Scheduling Features With the Nylas Scheduler

    Why stop with email functionality? User email inboxes and calendars are closely interlinked, and the Nylas Scheduler is the fastest way to add full calendar scheduling functionality to your application, allowing your users to create highly-customizable scheduling pages. With Nylas Scheduler, your users get their own custom link they can share with anyone to quickly match availability and schedule meetings.

    Nylas Scheduler and Inbox Zero

    Read the Guide: How to Launch Nylas Scheduler in 5 Minutes

    How to Run Inbox Zero

     Inbox Zero is built using:

    • Next.js, a framework for making server-rendered React apps
    • Express.js to create RESTful endpoints on the server
    • JSON Web Tokens (JWT) for authentication and session management
    • Lowdb, a lightweight key-value database powered by Lodash, for storing user information
    • The Nylas Node SDK – A client helper library that makes it easy to leverage the Nylas Communications Platform.

    To get ready to run this app, first, make sure you have Node installed on your local machine, then download the Inbox Zero git repo:

    git clone https://github.com/nylas/inbox-zero.git && cd inbox-zero

    Before you can use Inbox Zero, you need a Nylas account. If you don’t have one already, register now and start building for free. You can use the app that comes preconfigured with your Nylas account, or set up your own. Once you’ve created your account, take note of the Client ID and Client Secret for your Nylas App, we’ll need them in a moment.

    Inbox Zero stores the Nylas client ID and secret as environment variables, along with a secret that will be used to sign JWTs. For easy environment management, copy the .example-env file found in the repos top-level directory to a file named .env. Then, add your Nylas App client ID and secret to the appropriate lines and create a unique string for the JWT_SECRET variable.

    One last thing to consider: some providers have stricter requirements for user access. If you want to connect Google or Office365 accounts to Nylas, follow the setup instructions found at those links. Before you attempt to login to the Inbox Zero app, you’ll also need to register the callback address for the app with Nylas. In the Nylas dashboard, head to All Applications, press the Edit button next to your app, and add http://localhost:3000/api/authorize under the Callbacks tab. You’ll only have to do this once.

    Once all of this is done, run the following commands from the terminal, inside the Inbox Zero git repo to run the app.

    npm install
    npm run local

    You should now be able to access the Inbox Zero app by visiting http://localhost:3000 in your web browser. Feel free to poke around in the app’s code and make your own modifications. Got some cool ideas for this app? Share them in the comments below.

    The Nylas Communications Platform

    The Nylas Communications Platform is the easiest way to add full email functionality to your app, and with the information in this article, you’re now ready implement full email functionality into your app. But why stop there? With Nylas, developers also unlock the full capability of users’ calendars and contact books, and these combined with email functionality allow you to turn your app into a scheduling powerhouse. Let Nylas be the backend for your next email, calendar, and contacts integration and free up more time to focus on the features your users love.

    Related resources

    How to Send Emails Using an API

    Key Takeaways This post will provide a complete walkthrough for integrating an email API focused…

    How to build a CRM in 3 sprints with Nylas

    What is a CRM? CRM stands for Customer Relationship Management, and it’s basically a way…

    How to create an appointment scheduler in your React app

    Learn how to create an appointment scheduler in your React app using Nylas Scheduler. Streamline bookings and UX with step-by-step guidance.