Rate this page:

SendGrid Source

By using SendGrid Source with your SendGrid data in your data warehouse, you’ll be able to analyze your email activity (opens, clicks, deliveries, and bounces), lists, and recipients via SQL. Additionally, you can join your SendGrid data with Segment event and other source data you’re already sending to your warehouse, so you can correlate product feature usage with email activity, or tie referral sources into your customer journey analysis.

This documentation is managed by Segment. If you have any questions please contact Segment's support team at friends@segment.com.

Getting Started

  1. Create a Segment account
  2. Add SendGrid in the “Cloud Apps” Category and enter your credentials
  3. Setup a warehouse by bringing your own or having Segment setup and host
  4. Give the Source a nickname and schema name. We recommend sticking to something that reflects the source itself, like SendGrid for nickname and sendgrid or sendgrid_prod for the schema name.
  5. See SendGrid data in your data warehouse

Note that you can add multiple instances if you have multiple SendGrid accounts. That’s why we allow you to customize the source’s nickname and schema name!

In order to pull information about your contacts, we’ll make requests to SendGrid’s API with our sync component. So the first step in setting up the integration is to retrieve your API Keys and drop them into the Segment interface. You can create an API Key by navigating to Settings > API Keys, clicking General API Key.

We recommend providing read permissions for Email Activity and Marketing Activity.

Finally, copy the resulting API Key into the Segment interface, taking care to trim any errant trailing spaces from copying and pasting, and press connect.

In the next step, copy the auto-generated Webhook URL and paste it into SendGrid’s Event Notification settings pane under Settings > Mail Settings.

Once you enable the Event Notification, you’re good to go! Press Next, and then Finish to wrap up the setup flow.

Event URL

SendGrid has a single Event URL location. By using the SendGrid source, you will be using your only Event URL location. If you remove a pre-existing URL, then that location will no longer receive events.

Components

Sync

SendGrid has a sync component, which means we’ll make requests to their API on your behalf on a 3-hour interval to pull the latest data into Segment. In the initial sync, we’ll grab all the SendGrid objects (and their corresponding properties) according to the Collections Table below. SendGrid objects will be written into a separate schema, corresponding to the source instance’s schema name you designated upon creation.

Our sync component gets resources from SendGrid and forwards them to Segment using an upsert API, so the dimensional data in your warehouse loaded will reflect the latest state of the corresponding resource in SendGrid. For example, if lists.recipient_count goes from 100 to 200 between syncs, on its next flush to your warehouse, that tickets status will be 200.

Streaming

The SendGrid source also has a streaming component which listens in real time for inbound webhooks from SendGrid’s Event Notifications and batches the events to be uploaded on your next warehouse flush. These events are only ever appended to your warehouse. At present, there is no way to retrieve email event history from SendGrid, so you will only have access to data that we’ve collected after you successfully enable this component of the source integration.

Collections

Collections are the groupings of resources we pull from your source. In your warehouse, each collection gets its own table.

Object collections are updated with each sync. These are pulled via our sync component.

Event collections are append-only, represent a user action or activity, and may be likened to fact tables in a traditional data warehouse.

For a complete visual breakdown of the SendGrid collections and all their properties, view the Visual Schema here.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.

        
        
        

        Thank you for your feedback!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more