Using Sendgrid with Moesif API Analytics to Send Behavioral Emails

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

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.

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


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

Setting up an Email Server

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

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

The following screenshot illustrates how you navigate to the credentials.

Sendgrid SMTP Relay

This will start a guide that will lead you through the Sendgrid API key creation, give you the SMTP credentials, and also test that everything works as expected.

Sendgrid Create API Key

The API key needs a name to be created. The generated API key will be your SMTP password.

Sendgrid Get Password

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 Behavioral Emails

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

If you have problems with the SSL port, you can used port 587.

The Moesif form looks like this:

Moesif Add SMTP Credentials

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.

Sendgrid Verify Integration

Press verify integration in the Sendgrid console and Sendgrid will wait for you to send a test email.

After that click the “Test” button in the Moesif site and enter the target email.

Moesif Add From Email

The Sendgrid console will then confirm that the SMTP connection worked.

Sendgrid Integration Success


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

Using a service like Sendgrid 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 Sendgrid, 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
Automate developer outreach with Moesif Automate developer outreach with Moesif

Automate developer outreach with Moesif

Learn More