Skip to content

Mailgun webhook setup

Konstantinos Servis edited this page Dec 16, 2017 · 4 revisions

HOME > SNOWPLOW SETUP GUIDE > Step 2b: setup a Webhook > Mailgun webhook setup

Contents

1. Overview

This webhook integration lets you track a variety of events logged by Mailgun.

Available events are:

  • Delivered Messages
  • Dropped Messages
  • Hard Bounces
  • Spam Complaints
  • Unsubscribes
  • Clicks
  • Opens

For the technical implementation, see Mailgun webhook adapter.

1.1 Compatibility

2. Setup

Integrating Mailgun's webhooks into Snowplow is a two-stage process:

  1. Configure Mailgun to send events to Snowplow
  2. (Optional) Create the Mailgun events tables into Amazon Redshift

2.1 Mailgun

First login to Mailgun. Select Webhooks from the top panel.

Then select the domain for which you want to configure snowplow.

Once you have the desired domain selected, you can configure snowplow for the type of events that interest you (all events are supported as per the list in overview as of the time of writing 15.12.2017).

Following is an example configuring the "Spam Complaints" event. The process is identical for all events.

Click on the cross next to the event type you woudl like to configure. In this case "Spam Complaints":

Then set the collector URL:

http://<collector host>/com.mailgun/v1

Finally click on Set Webhook URL. You can optionally click on Test Webhook to verify that your collector instance is reachable from Mailgun's servers.

You may want to set the snowplow aid= parameter in your URL query string to the company for which this webhook has been configured; this is the app_id parameter taken from the Snowplow Tracker Protocol, however this is optional. The company is also contained in the received messages.

If you want, you can also manually override the event's platform parameter by appending a query string to the end of the URL, in combination or separately with aid above. Here is what the final URL would look like for a configured aid and platform:

http://<collector host>/com.mailgun/v1?aid=<company>&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.

2.2 Redshift

If you are running the Snowplow batch flow with Amazon Redshift, then you should deploy the relevant event tables into your Amazon Redshift.

You can find the table definitions here:

Make sure to deploy this table into the same schema as your events table.

That's it - with this table deployed, your Mailgun events should automatically flow through into Redshift.

Clone this wiki locally
You can’t perform that action at this time.