By Rudderstack Team

How to load data from SendGrid to Redshift

This post shows you how to route your SendGrid data to Redshift. If you are looking to get analytics-ready data without the manual hassle, you can integrate SendGrid to Redshift with RudderStack, so you can focus on what matters - getting value out of your transactional email campaign data.

Extract your data from SendGrid

There are two main methods to get our data from SendGrid, the first one is to pull data out from it and the second one is for SendGrid to push data to you whenever and important event is triggered, the second solution is also offering a real time aspect to the analytics we can perform with SendGrid. We will see how we can access data from both.

In order to pull data from SendGrid, we need to access its HTTP API. As a Web API following the RESTful architecture principles, it can be accessed through HTTP. As a RESTful API, interacting with it can be achieved using tools like CURL or Postman or using HTTP clients for your favorite language or framework. A few suggestions:

SendGrid maintains a number of officially supported clients or SDKs that you can use with your favorite language to access it without having to mess with the raw underlying HTTP calls. These are the following:

C# client

There’s also a huge list of community supported libraries that you can use if you wish, a complete list can be found here.

SendGrid is currently maintaining 4 APIs that can be accessed:

  1. SMTP API - SendGrid’s SMTP API allows developers to specify custom handling instructions for e-mail.
  2. Web API v3 -The latest version of the SendGrid API, which is completely RESTful, fully-featured, and easy to integrate.
  3. Web API v2 - The previous version of the SendGrid API, still maintained for compatibility reasons. It is recommended that v3 is used instead of it as soon as possible.
  4. Webhooks - Webhooks are an easy way to get push notifications from SendGrid.

For this guide, we are considering the v3 of the Web API and Webhooks.

SendGrid API Authentication

Authentication for accessing the SendGrid Web API happens through API keys. You generate an API Key that then you can pass together with your requests to the API and your application will be authenticated. Additionally to the creation of API Keys, SendGrid also allows the creation and management of API Key permission lists. So you can create Keys that will have different levels of access to SendGrid for your account. API requests you make to the Web API v3 must be authenticated by including an Authorization Header with your API Key.

About SendGrid

Sendgrid‘s mission is to help you to deliver your transactional and marketing email through one reliable platform. It is a transactional e-mail platform offering services similar to Mandrill and mailgun. Although there’s a belief that SendGrid is more for newsletter like email services, it can also be used for on-boarding, registration and any kind of personalized and targeted one to one emails to your customers. Some of the benefits that SendGrid offers are:

1. You can select which protocol to use for sending your e-mails. It can be either SMTP or HTTP, so it offers flexibility on the protocol level.

2. Scalable SendGrid offers an infrastructure capable of scaling up and down just as your mailing needs do. No matter if you send 100 or a billion e-mails, SendGrid can handle the load transparently for you.

3. Guaranteed mail delivery - Compliance with CAN-SPAM and management of spamming and reputation for mail servers can guarantee a much higher delivery rate for your e-mails. You can be sure that your e-mails will not be mistaken with spam from the recipient mail server.

4. Easy and fast integration - No matter what kind of e-mails you want to send, transactional or marketing, custom integration with SendGrid is extremely easy. Different APIs exist to cover different needs together with a large number of SDKs and libraries that can ease even further the integration process. You can have SendGrid integrated, up and running in a matter of minutes.

5. Security - All emails send via SendGrid utilise opportunistic TLS encryption, so as long as your recipient servers are configured to use TLS you can be sure that all mails will be sent via a secure channel to them.

6. Powerful and actionable Analytics - The SendGrid platform in real-time reports eThe SendGrid platform in real time reports everything related to your marketing campaigns or transactional emails that can be tracked. Analytics can be either used through the dashboards that SendGrid has or can be pulled by the API to be used as part of custom analytics solutions, which is also the scope of this article.

Just like every platform that offers a programmatic access to email, SendGrid has been built from the ground up as an API company. This means that you will need to incorporate some technical skills to gain full access to its capabilities. Nevertheless, SendGrid also offers an intuitive web environment that can be used by marketeers to manage and execute marketing campaigns without the need of technical support.

SendGrid rate limiting

There are limitations to delivery rates imposed by recipient mail servers. Exceeding these limitations results in a practice referr