How to Send Behavioral Emails with Mailgun and Moesif API Analytics

In this guide you’ll learn how to send Moesif behavioral emails with Mailgun.

Moesif behavioral emails is a feature that automatically sends emails to customers based on their API usage. This can be used to notify customers about technical issues, such as hitting rate limits, using deprecated APIs, or broken integrations. You can even use it to trigger business-related events such as when an item is shipped. If something can be mapped to an API call, then you can send an email from it.

In a companion article, we covered how to configure behavioral emails within your Moesif dashboard.

Mailgun is a managed email service. They offer an API to send emails to your users and host SMTP servers for you.

Prerequisites

This how-to guide requires a Moesif account and a Mailgun account.

Setting up an Email Server

The first step in setting up the email server is getting the SMTP credentials from Mailgun.

For this, you have to log into the Mailgun dashboard.

The following screenshot illustrates how you navigate to the credentials.

 Mailgun Dashboard

These credentials have to be entered into the Moesif email server configuration form.

To navigate to the form, follow the steps in the next screenshot.

 Moesif Email Server Form

You can copy and paste the credentials from the Mailgun site to the Moesif site.

The Moesif form looks like this:

 Moesif Email Server Form

Learn More About Moesif Track the end to end customer journey with Moesif 14 day free trial. No credit card required. Learn More

Testing the Setup

You can then send an example email via the freshly configured SMTP server with Moesif.

After you’ve configured the mailserver, you have to create a new email template:

Moesif Create a Blank Email Template

For the new template, you have to fill out the required fields: template name, subject line and from email address.

Once that is done, click the “Test” button and enter the target email.

Moesif Add From Email

If everything worked correctly you’ll see the a new email in your inbox, also the Mailgun Dashboard will show that it has sent the email.

 Moesif Email Server Form

Summary

Setting up Moesif behavioral emails with Mailgun only takes a few minutes.

Using a service like Mailgun alleviates many common problems that might occur when sending email, such as validation issues and email being incorrectly identified as spam.

By combining Moesif’s behavioral email service with Mailgun, you’re able to keep your API consumers abreast of important issues.

Learn More About Moesif Make Your API Platform Successful with Moesif 14 day free trial. No credit card required. Learn More
Keep API Consumers Informed with Moesif Keep API Consumers Informed with Moesif

Keep API Consumers Informed with Moesif

Learn More