SendGrid webhook setup - OXYGEN-MARKET/oxygen-market.github.io GitHub Wiki
HOME > SNOWPLOW SETUP GUIDE > Step 2b: setup a Webhook > SendGrid webhook setup
- 1 Overview
- 1.1 Compatibility
- 2 Setup
- 2.1 SendGrid
- 2.2 Snowplow Redshift
This webhook integration lets you track a variety of events logged by SendGrid.
Available events are:
- Processed
- Dropped
- Delivered
- Deferred
- Bounce
- Open
- Click
- Spam Report
- Unsubscribe
- Group Unsubscribe
- Group Resubscribe
For the technical implementation, see SendGrid webhook adapter.
-
Snowplow 75 Long-Legged Buzzard + (
POST
-capable collectors for event processing, will requireGET
for initial webhook validation) - SendGrid webhook API
Integrating SendGrid's webhooks into Snowplow is a two-stage process:
- Configure SendGrid to send events to Snowplow
- (Optional) Create the SendGrid events tables for Amazon Redshift
First login to SendGrid. Select Settings from the menu panel along the left hand side of the screen. You should then navigate in the expanded list to the Mail Settings page.
Select Event Notification from the list by clicking the row. Ensure it's switched ON in order to send events to Snowplow.
Click edit on the top right hand side of the Event Notification dropdown.
For the HTTP POST URL field you will need to provide the URI to your Snowplow Collector. We use a special path to tell Snowplow that these events are generated by SendGrid:
http://<collector host>/com.sendgrid/v3
Our Webhooks setup page should look like this after we have added our HTTP POST URL:
If you want, you can also manually override the event's platform
parameter by appending a query string to the end of the URL so:
http://<collector host>/com.sendgrid/v3?p=<platform code>
Supported platform codes can again be found in the Snowplow Tracker Protocol; if not set, then the value for platform
will default to srv
for a server-side application.
Before we save our SendGrid webhook we can configure what types of events SendGrid will send to our webhook and what channels will trigger these events. Simply select the boxes that are applicable to you and SendGrid will send these events to our webhook.
If you are running the Snowplow batch (Hadoop) flow with Amazon Redshift, then you should deploy the relevant event tables into your Amazon Redshift.
You can find the table definitions here:
- com_sendgrid_processed_1.sql
- com_sendgrid_dropped_1.sql
- com_sendgrid_delivered_1.sql
- com_sendgrid_deferred_1.sql
- com_sendgrgid_bounce_1.sql
- com_sendgrid_open_1.sql
- com_sendgrid_click_1.sql
- com_sendgrid_spam_report_1.sql
- com_sendgrid_unsubscribe_1.sql
- com_sendgrid_group_unsubscribe_1.sql
- com_sendgrid_resubscribe_1.sql
Make sure to deploy this table into the same schema as your events
table.
That's it - with these tables deployed, your SendGrid events should automatically flow through into Redshift.