Skip to main content
Version: 1.4.x

Mailgun

Use your own Mailgun account to deliver notifications to your users via Engagespot. For this you need a Mailgun account, and few other credentials from Mailgun.

Unique Identifier

Each provider is identified by a unique identifier. Unique identifier of Mailgun provider is mailgun

Enabling Mailgun Provider

To enable Mailgun provider, login to your Engagespot Console, goto Channels -> Email and enable Mailgun Provider.

info

Mailgun email provider uses email attribute in your user's profile as the primary address to deliver the notifications. So make sure your user's profile has the email attribute set.

Mailgun Provider Configurations.

Mailgun Provider requires the following configurations.

ConfigurationDescriptionRequiredExample
apiKeyYour Mailgun API KeyYes21b20a854e3df1ac46cb3aa2b9c6fd314
regionRegion of your Mailgun accountYesIt should be either US or EU
domainYour registered Mailgun DomainYessandboxb9e650f115fc4f55beer32b60c33fc98.mailgun.org
fromEmailFrom email addressYesnoreply@myapp.com

How we send email via Mailgun?

We simply use Mailgun API to deliver your notifications. By default, if you donot override anything, we'll consider your notification.title as the email subject, a combination of your notification.title and notification.message as your email's body (Plain text), and if you have specified notification.url, we will add a default button to your email with Click Here label.

Overriding Configurations

Mailgun provider allows you to override all the above configurations (and you can specify several more options) while sending a notification through Engagespot API, using the https://api.engagespot.co/v3/notifications endpoint.

To override the configurations, you must supply them via override.mailgun parameter of the above API. Within the override parameter, you can supply any parameter that we'll directly pass to Mailgun /v3/mail/send API See doc. This makes sure you can use the complete features of Mailgun API while still using Engagespot to control your notifications!

For example,

POST /notifications

{
"notification": {
"title": "Anand commented on your photo",
"message": "Hey Steve, you're looking cool 😎. Who took this photo?",
"url": "https://your-app.com/photos/17293739",
"category": "comment"
},
"recipients": ["steve@example.com"],
"override": {
"mailgun": {
"_config": {
"apiKey": "21b20a854e3df1ac46cb3aa2b9c6fd314",
"domain": "sandboxb9e650c33fc98.mailgun.org"
},
"subject": "Hey, I'm overriding the subject",
"html": "I want more content in my email <b>notification</b>",
"whatever": "keys and values you pass here will be directly sent to Mailgun's Send API 🎉"
}
}
}

Within the override object of a provider, there is a _config property where you can override the default configurations defined in Engagespot Console for that provider. This property will be removed before merging the override object with providers API.

Setup delivery tracking

To set up delivery tracking for the Mailgun provider is really simple,

First off, you’ll need the URL from the system from which you want to receive the events. for that got to Engagespot Console -> Channels -> Email -> Configured Providers -> Mailgun Instance -> Edit You can see the callback URL like this. Just copy this callback URL.

After Copying callback URL , login in at mailgun

  1. In the Mailgun application UI, navigate to Sending > Webhooks.
  2. Under Webhook Settings, click Add Webhooks.
  3. A dialog will open where you can configure the Event Webhook, you can paste your callback url in the URL input and choose event type.

Done! now you'll see these events in your Engagespot Console logs.