An Introduction to Email APIs and How You Can Use Them
Learn how to use email APIs to build features faster and ship products sooner.
Tasia Potasinski | June 12, 2019
Email is the de facto standard of communication for businesses of every size. Tens of billions of emails are sent every day, a non-stop conversation between businesses and their customers around the globe!
Yet sending emails manually is time-consuming and error-prone. Doing so at scale to thousands of people is nearly impossible without the serious attention of a developer. While it’s possible to write software to automate your emails from scratch, this inevitably requires constant maintenance and upkeep.
Email service providers (ESPs) like Gmail, Microsoft Exchange, and Outlook.com offer software developers a simpler abstraction to handle programmatic email, allowing them to focus on their application rather than things like MIME header construction or overseeing measures to encrypt and transmit email data securely.
Building your own integration with an ESP is always possible but has inherent risks:
- The high opportunity costs for an initial build
- The ongoing cost of maintenance and managing updates and versions
- It takes as long as 12 months or more for a team of engineers to implement
- The costly, time-consuming security & compliance certifications
- The burden of security infrastructure
In many cases, these caveats prompt companies to integrate with an email API (application programming interface) platform like Nylas. This enables developers to quickly add full email functionality, ship products and go to market faster. For developers, a universal RESTful API abstracts away the messy details of sending email using traditional protocols and allows them to dedicate their efforts to more meaningful product differentiators.
Side Note on SMTP vs. Web API: There are two primary methodologies used for sending and receiving email programmatically: SMTP (Simple Mail Transfer Protocol) and HTTP (Web) API. Web APIs grant additional capabilities not offered by legacy protocols — we’ll review some of those benefits below. We’ll also be diving deeper into the pros and cons of SMTP and how it compares to using the Web API in a future post!
If you’re a developer, you know that APIs are how you invoke the functionality of other cloud-based software services. APIs consist of useful functions and where to find them (known as endpoints) and are provided publicly by a software provider to make using their service possible. By conforming to modern conventions such as REST, allowing only a uniform, predefined set of stateless operations, a well-designed API can be leveraged to integrate new software capabilities in minutes instead of months!
The REST ideology yields a predictable pattern of simple URI endpoints which are used to access and modify particular data objects. Requests to Web APIs use standard HTTP methods like GET, PUT, POST, and DELETE, as well as status codes. Data responses and metadata are usually encoded as JSON or XML, standardized data representations that are human and machine-readable.
What is an Email API?
An email API allows applications to access functions offered by the email service provider’s platform, including generating and sending transactional emails, manipulating templates, moving or editing folders, building drafts, and more. On top of that, APIs enable powerful analytics on this data — which you otherwise wouldn’t get by integrating with the ESP directly. Email API providers take care of protocol matters such as message assembly, message sending, and reporting that would otherwise need to be specified by the application software development team.
Email APIs fall broadly into two categories: transactional and contextual.
Transactional email APIs are designed for sending bulk or routine emails like notifications, password reset emails, and mass marketing campaigns through third-party platforms. MailChimp and SendGrid are examples of well-developed transactional email API providers.
Contextual email APIs are designed to embed robust email connectivity directly into software applications. Productivity tools, CRMs, applicant tracking systems, and even car consoles use email APIs to embed email functionality into the application. Contextual emails allow you to sync, send, receive, and collect analytics, as well as taking care of general CRUD for each email service provider connection. The Nylas Email API acts as a layer of abstraction on top of all email providers and is an example of a contextual email API provider.
Let’s step through an example use case for a contextual email APIs: a single integration for syncing and sending emails to and from multiple user’s email service providers simultaneously.
- An event occurs within a web or mobile application, such as a button press to send a message to someone while viewing their profile.
- The host application uses an embedded email API to communicate details of the request to a cloud service that maintains connections to all email service providers. The request needs only to include the minimum relevant information. This is because the email API platform is always connected to unified contact details from synced services.
- The email API platform constructs an appropriate message for each synced email service provider’s specifications, inserting the message content supplied by the user application, and according to procedural flags as desired.
- The email API platform negotiates the technical handshakes for each connected service, ensuring that messages reach each destination with integrity.
- The email API platform logs each exchange and its particulars, to be summarized for analytic dashboards and diagnostic reports.
Email APIs ensure the most efficient I/O performance for email applications because they substantially reduce the amount of data that needs to be transmitted. That is to say, applications do not need to transmit fully constructed email messages with header information, they can simply send key:value pairs related directly to the content of the message: subject, body, recipients.
Intermediary email API service layers like Nylas have a key advantage in reducing the “surface area” of requests to a narrow and consistent set that holds true even when the other side of the request is expecting a very different request format. For example, you can use the same RESTful API methods to interact with both a cloud Gmail service and an on-premise Microsoft Exchange setup in the same manner, despite the two systems communicating very differently from one another.
Perhaps the greatest advantage that an email API brings to application development is time freed up to work on other features. By specializing in your product development rather than the minutiae of email integration protocols, you ultimately accrue a valuable competitive advantage by focusing on your unique strengths.
Using an Email API
A simplified example of constructing and sending email using a call to a web API:
POST api/emails from = 'Nylas <[email protected]>' to = '[email protected]' subject = 'No protocols or servers required' text = 'How delightfully intuitive it is to use a web API!'
You can test out a variety of API calls and get real responses on the Nylas docs here.
Key Benefits of Email APIs
Email APIs can save as much as 12 months of time for development teams by providing one simple, RESTful API to integrate with every provider. They offer a range of value for teams of any size:
- Fast implementation
- Cost Savings at scale
- Service Reliability
- High Deliverability
- Email list management (e.g. unsubscribe requests)
- Reports and Analytics Dashboards
- Deep personalization (contextual APIs)
- Embeddable email functionality for applications (contextual APIs)
- Enterprise-grade security
In addition to the time savings and reliability improvements, email APIs help you build user-facing product enhancements faster such as analytics, near-perfect email deliverability, and personalization.
Analytics are essential for any meaningful assessment of your email campaigns and email API providers are perfectly situated as an intermediary layer to help you track metrics such as how many messages were successfully delivered, how many messages were rejected by an ISP, reasons for messages not being delivered, how many recipients opened a message, or how many call-to-action links were clicked.
Deliverability, or the success with which your messages reach their intended recipients at the intended time, depends on dozens of technical factors and contingencies. Fortunately, web email API providers excel at ensuring maximum deliverability and are able to run their mail servers with expert supervision 24 hours a day, 7 days a week. They are responsible for mitigating any interruptions caused by Internet outages, natural disasters, distributed denial of service attacks, and a variety of other network problems that could impact the delivery of your messages. Their service guarantees that you won’t lose any business because your servers were unable to respond or improperly configured.
Personalization and webhooks-based triggers
Personalized triggers based on context-dependent application events enable you to send emails to effectively drive growth marketing campaigns with a bespoke touch. If you use webhooks on your website or in emails, you can also use email APIs to automate this programmatically.
For developers, the upshot of using an email API is that your team can plug in code quickly and intuitively according to the simpler interface of the email API provider, then move on to meatier issues.
Ship Faster With an Email API Platform
Email has always been a deeply technical challenge for any developer who wants to build deep integrations and move fast. But with the advent of cloud server architecture and API-driven email service platforms, companies can build complex, highly performant email functionality into their applications with little or no knowledge of email administration or telecommunications protocols. Partnering with an email API provider offers a streamlined workflow for quickly integrating functionality and grants features such as service reliability guarantees and analytics reports.
See the Nylas email API in action by creating an account getting a free email API key here.
In our next post, we’ll dive into transactional vs. contextual APIs, examining which use cases are appropriate for each.