How to build an email outreach tool with Nylas

10 min read
Tags:

Key takeaways

By the end of this how-to guide, you’ll learn:

  • What is email outreach: This blog explains the fundamentals of email outreach, its role in driving engagement, and why personalized communication is critical for building lasting relationships with your audience.
  • Planning your outreach strategy: Learn how to build a strong outreach foundation by understanding your audience’s preferences, optimizing the content and timing of your emails, and maintaining the right communication frequency.
  • How to build an email outreach tool using Nylas: Follow a step-by-step guide that walks you through setting up a custom email outreach tool using the Nylas Email API. You’ll see how to authenticate, send personalized emails, and automate your workflows to save time and effort.

You’ll understand the key components of successful email outreach but also have the tools and code examples you need to build a robust outreach solution in Nylas. Whether you’re aiming to nurture leads, engage customers, or scale your communication efforts, this guide will help you get started.

In today’s fast-paced, digital landscape, personalized and efficient email outreach is essential for nurturing leads, engaging customers, and driving growth. But building a scalable email outreach tool from scratch can be challenging without the right infrastructure. That’s where the Nylas comes in—it simplifies email integration, letting you focus on crafting impactful email outreach workflows rather than managing complex protocols.

In this blog, you’ll learn how to build an email outreach tool using Nylas, complete with step-by-step instructions and code samples that you can quickly copy and test in the Nylas sandbox environment. Whether you’re a product manager seeking a high-level overview or an engineer ready to dive into implementation, this guide has everything you need to get started.

What is an email outreach tool?

An email outreach tool enables you to build and send personalized, on-brand emails to targeted audiences, helping you drive meaningful engagement and achieve your specific goals. When used correctly, email outreach can be highly effective in driving conversions, engagement, and brand awareness.

Before implementing automated email outreach, it’s important to establish a solid foundation in these key business areas:

  1. Your target audience: People have different preferences for how they receive and engage with customer communications. To maximize the impact of your email outreach, understand your audience’s communication preferences before you begin
  2. Your outreach methods: Consider the assets you may want to send in your emails–if any– and how your customers may respond to them. The goal is to send your customers the right content, at the right time, via the channel they prefer.
  3. Your frequency of outreach: Moderation is key. Sending too many emails can be overwhelming and lead to customers unsubscribing. 

The Nylas Email API simplifies access to data and features from various email service providers through a single, easy-to-use interface. It enables developers to integrate multiple email services into a single application quickly—without lengthy development cycles, complex maintenance, or subpar user experiences. With these best practices in mind, let’s dive into building an email outreach tool with Nylas.

How to build an email outreach tool with Nylas: A step-by-step guide

Before we start, ensure you have a Nylas account to get your API key. If you’re not registered, sign up for free here.

Get a deeper look into authenticating, setting up templates, and automating email sending—all with code samples that can be copied, tweaked, and tested. The Nylas Email API is designed to save your team time and effort while delivering a personalized experience for your email recipients.

1. Generate a new API Key 

Once logged in, click on “API Keys” from the left side menu and select the “Generate new key” button in the upper right corner. Store a copy of the API Key as it will not be accessible again in the dashboard.

Click on “Grants” from the left side menu and select the “Add Test Grant” button in the upper right corner. Follow the process to connect an email account and generate a grant ID.

2. Create email templates

Generate email templates that your users can use, ensuring that they:

  • Are built using HTML for better formatting and design. (If you’re looking to build email templates in React, check out this guide on How to build email templates with React)
  • Include placeholders that can populate specific fields such as first name, last name, company, etc.

You can store these templates locally in your application or use Nylas’ drafts endpoint to save them directly to the email account for future sending.

With Nylas, you can choose to send messages immediately or schedule them according to a cadence. When sending immediately, you’ll use the Nylas send endpoint. When scheduling emails to be sent in the future, you will use that same endpoint and include a “sent_at” timestamp in the Post request. All scheduled emails are available via the scheduled send GET request endpoint

curl --request POST \
  --url https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/messages/send \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
	"subject": "Hey Reaching Out with Nylas",
	"body": "Hey I would like to track this link <a href='https://espn.com'>My Example Link</a>",
	"to": [
		{
			"name": "John Doe",
			"email": "[email protected]"
		}
	],
	"tracking_options": {
		"opens": true,
		"links": true,
		"thread_replies": true,
		"label": "hey just testing"
	}
}'

3. Activate the send endpoint

When using the send endpoint, the payload will need a recipient in the To field, but it can also accommodate additional recipients using the CC and BCC fields. You can enter a subject and the body of the email in any format, usually HTML. Upon sending, the message will be delivered by the underlying connected email account, which Nylas directs programmatically. There is no need to set up SPF, DMARC, or DKIM records on behalf of the account. 

This is sent with an email deliverability success rate that matches the reputation of the underlying account. Once the message is sent, the API will return with a 200OK if it was successfully sent or with an error message if there was an issue in sending the email.  

4. Add a tracking subobject

When using the Nylas /send endpoint, a tracking subobject can be added to payload to enable tracking for that particular message. With this subobject, you can enable tracking for email opens, links clicked within the email, and replies to the email. Bounce detection is also possible by subscribing to a bounce detection webhook. 

5. Activate thread replies

At the time of sending an email, the API will auto-assign a Thread ID to the email conversation.  With this Thread ID, Nylas tracks the threads that have an enabled flag for thread.replies tracking. When this thread receives a reply email, a thread.replies webhook will trigger and notify your application that a reply for a tracked thread has arrived into the inbox. This way, your application can track replies to threads of interest without having to monitor all incoming messages to the inbox.

{
 "specversion": "1.0",
 "type": "thread.replied",
 "source": "/com/nylas/tracking",
 "id": "d67b0806-b263-4fca-b297-c62478a66e01",
 "time": 1696007157,
 "data": {
   "application_id": "NYLAS_APPLICATION_ID",
   "grant_id": "NYLAS_GRANT_ID",
   "object": {
     "message_id": "<message-id-of-reply>",
     "root_message_id": "<message-id-of-original-tracked-message>",
     "label": "some-client-label",
     "reply_data": {
       "count": 1
     },
     "sender_app_id": "<app-id>",
     "thread_id": "<thread-id-of-sent-message>",
     "timestamp": 1696007157
   }
 }
}  

6. Update email cadences

If a message cadence has already been scheduled through a queue, you can programmatically cancel it upon receiving a thread.replies webhook. This is done by deleting all pending messages and updating your database to ensure no future cadence-related emails are sent. Now that the recipient has responded, the engagement can continue within your application using Nylas’ bidirectional sync and threading technology to track conversations.

curl --request DELETE \
  --url 'https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/messages/schedules/<SCHEDULE_ID>' \
  --header 'Accept: application/json, application/gzip' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>'

7. Identify most-engaged recipients

By tracking webhook triggers for email opens, link clicks, and replies, you can prioritize email threads and apply a scoring system to highlight the recipients most engaged with your content and communication. These statistics can signal motivation and allow your application to prioritize communication coming from your most engaged recipients.

Link Clicked Webhook Schema: message.link_clicked

{
 "specversion": "1.0",
 "type": "message.link_clicked",
 "source": "/com/nylas/tracking",
 "id": "4eabe42e-50e4-42ce-9014-0d602ed8e2ba",
 "time": 1695480423,
 "data": {
   "application_id": "NYLAS_APPLICATION_ID",
   "grant_id": "NYLAS_GRANT_ID",
   "object": {
     "link_data": [{
       "count": 1,
       "url": "https://www.example.com"
     }],
     "message_id": "18ac281f237c934b",
     "label": "Hey, just testing",
     "recents": [
       {
         "click_id": "0",
         "ip": "<IP ADDR>",
         "link_index": "0",
         "timestamp": 1695480422,
         "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
       },
       {
         "click_id": "1",
         "ip": "<IP ADDR>",
         "link_index": "0",
         "timestamp": 1695480422,
         "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
       },
       {
         "click_id": "2",
         "ip": "<IP ADDR>",
         "link_index": "0",
         "timestamp": 1695480422,
         "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
       }
     ],
     "sender_app_id": "<app id>",
     "timestamp": 1695480422
   }
 }
}  

Email Opened Webhook Schema: message.opened

{
 "specversion": "1.0",
 "type": "message.opened",
 "source": "/com/nylas/tracking",
 "id": "b1e59587-0f85-4dd6-9ab9-d174b97bbdc9",
 "time": 1695480567,
 "data": {
   "application_id": "NYLAS_APPLICATION_ID",
   "grant_id": "NYLAS_GRANT_ID",
   "object": {
     "message_data": {
       "count": 1,
       "timestamp": 1695480410
     },
     "message_id": "18ac281f237c934b",
     "label": "Testing Nylas Messaged Opened Tracking",
     "recents": [
       {
         "ip": "<IP ADDR>",
         "opened_id": 0,
         "timestamp": 1695480567,
         "user_agent": "Mozilla/5.0"
       },
       {
         "ip": "<IP ADDR>",
         "opened_id": 1,
         "timestamp": 1695480567,
         "user_agent": "Mozilla/5.0"
       },
       {
         "ip": "<IP ADDR>",
         "opened_id": 2,
         "timestamp": 1695480567,
         "user_agent": "Mozilla/5.0"
       }
     ],
     "sender_app_id": "<app id>",
     "timestamp": 1695480410
   }
 }
}

8. Continue cadence-based emails

Non-engaged leads can continue receiving regular cadence-based emails, keeping them informed about your offerings until they’re ready to engage with your content. 

9. Build a high-level dashboard

To monitor all these activities from a high-level perspective, create a dashboard using Nylas’ Calendar API that provides key metrics, such as the number of outbound emails, responses, bounces, clicks, and email opens. This will help you evaluate the effectiveness of your email outreach efforts and forecast your pipeline’s future potential.

Build smarter email outreach with Nylas

Creating a personalized and efficient email outreach tool doesn’t have to be overwhelming. By using the Nylas Email API, you can streamline integrations across multiple email service providers and focus on delivering meaningful, engaging experiences to your audience. With Nylas, you’ll save valuable development time, reduce maintenance overhead, and enhance your email outreach strategy with ease.

Ready to take your email outreach to the next level? Sign up for free to access the Nylas sandbox environment and start building your own email outreach tool today.

Related resources

How to manage calendar availability with Nylas

Key takeaways This blog walks you through how to efficiently manage and display real-time calendar…

How to combine Supabase Google Auth and Nylas Google App Permissions in a Next.js Application

Combine Next.js Supabase Google Auth with Nylas Auth lets you seamlessly access Email and Calendar data in your Next.js application. In this guide we’ll walk through configuring both providers, handling refresh tokens, and enabling advanced email and calendar features.

How to customize the Nylas Scheduler workflow with custom events

We’re excited to announce the launch of the Nylas Scheduler v3! Efficient scheduling is essential…