DEV Community

Cover image for Using the Mailgun Event API to Get Email Campaign Data for Beginners

Posted on

Using the Mailgun Event API to Get Email Campaign Data for Beginners

Mailgun’s API documentation is pretty good, but it’s clearly meant for developers who know their way around an API already. This post is meant to document what I’ve learned and help absolute noobs like myself get what you need from the Mailgun API.

I’m sending out a lot of emails—anywhere from 1,000 to 10,000 per day. I’ve tried almost every email system there is, and I really like the simplicity and flexibility of Mailgun’s platform, plus the low price is nice compared to Mailchimp, ActiveCampaign, etc.

The Mailgun user interface is good for most tasks, but the discount comes with a bit of a tradeoff in terms of self-serve versus in-built functionality. When you need to figure out exactly which emails opened or clicked on your campaigns, for instance, you need to call the API.

I go to all this trouble in order to create what I call “engaged lists”—people who have opened and clicked on my campaigns before (and who haven’t unsubscribed, of course). Sending only to these people can increase your sender reputation and seriously boost your stats. Sometimes, sending to 200 engaged emails can yield better results than sending to 2,000 lukewarm folks.

If you know how to use an API and don’t have a problem automating tasks for yourself, getting data from Mailgun’s API isn’t an issue. For us noobs and non-developers, however, it can be hard. I spent a good couple of hours figuring this out, so I’ll document what I’ve learned here. It’s not perfect, but it does the job. I’m going to try to automate some of this next, but here’s the current state.

Here’s an overview of how to get a list of who has opened and clicked on your emails from the Mailgun API:

Click here to read on!

Top comments (0)