# Mailgun + Krokul CRM

Yes. Krokul CRM integrates with Mailgun. A won deal, a new document or a paid invoice sends a Mailgun template e-mail to the contact, and Mailgun webhooks report deliveries, opens, clicks, failures, complaints and unsubscribes back to the same deal. Client replies arrive through a Mailgun route and appear as comments on the deal. The link runs through the Krokul app in Zapier, Make and n8n or through the Krokul API and webhooks.

**Status:** Via API and webhooks. **Automation platforms:** Zapier, Make, n8n.

## What your team gets

### A deal event sends a Mailgun template

You map a Krokul event to a Mailgun template, for example a paid invoice to a receipt. Krokul calls the Messages API with the template name, fills t:variables with the deal title, amount and document number, and adds the deal UUID as the v:deal_uuid parameter. The deal feed records which template went out and to which address.

### Delivery and engagement on the deal timeline

Mailgun posts a webhook for delivered, opened and clicked events, and each one carries the user-variables of the original message. Krokul reads the deal UUID from them and adds the event to the deal. The manager sees the opened offer before the follow-up call.

### Failures and complaints mark the contact

A permanent_fail event tells Krokul that the address cannot receive mail. Krokul marks the contact with the reason from the event and opens a task to check the address. Complained and unsubscribed events mark the contact too, and later event rules skip it.

### Client replies through a Mailgun route

A route with match_recipient on your reply address forwards each incoming message to Krokul. The forward carries the sender, the subject, stripped-text without the quoted history and the message-headers. Krokul finds the contact by the sender address, follows In-Reply-To to the message it sent and adds the reply as a comment on that deal.

## What moves between Mailgun and Krokul

| Mailgun | Krokul | Direction | When |
|---|---|---|---|
| Messages API with template and t:variables | Won deal, document or paid invoice | Krokul → Mailgun | The Krokul event fires |
| v:deal_uuid parameter | Deal reference | Krokul → Mailgun → Krokul | Every send |
| Webhook delivered, opened, clicked | Activity on the deal | Mailgun → Krokul | Mailgun processes the message |
| Webhook permanent_fail | Mark and task on the contact | Mailgun → Krokul | The address rejects the message |
| Webhook complained, unsubscribed | Mark on the contact | Mailgun → Krokul | The recipient opts out |
| Route forward() with stripped-text | Comment on the deal | Mailgun → Krokul | The client replies |
| Mailing list member | Contact | Krokul → Mailgun | A contact is created |

## How to connect today

### Krokul app in Zapier, Make or n8n

1. Connect the Krokul app with a Krokul API key and Mailgun with a Mailgun API key and your sending domain.
2. From the Krokul trigger Invoice Paid or Deal Won, call Send Email in Zapier or Send an email in n8n.
3. From New Bounce Event or New Inbound Email via Route in Zapier, or New Event: Permanent Failure in Make, use the Krokul search Find Contact and then Add Comment or Create Task.
4. From the Krokul trigger Contact Created, call Add Mailing List Member in Zapier or Add a Mailing List Member in Make.

### Custom flow through the Krokul API and webhooks

1. Create a Mailgun API key for the sending domain and copy the Webhook Signing Key. In Krokul, issue an API key scoped to contacts, deals and activities.
2. Subscribe a Krokul webhook to card.won, document.created and invoice.paid, verify x-crm-signature and send through the Messages API with the deal UUID in v:deal_uuid.
3. Register Mailgun webhooks for delivered, opened, clicked, permanent_fail, complained and unsubscribed. Check the HMAC-SHA256 of timestamp and token on each request, then write activity/api-create on the deal from user-variables.
4. Add a route with match_recipient and forward() to your receiver, find the sender with contact/api-find and write the reply as a comment.

**Triggers:** New Delivery Event; New Open/Click Event; New Bounce Event; New Failed Delivery Event; New Complaint Event; New Unsubscribe Event; New Inbound Email via Route; New Event: Permanent Failure; New Event: Opens; New Event: Clicks.

**Actions:** Send Email; Add Mailing List Member; Validate Email; Add a Mailing List Member; Create a Route; Send an email.

### For integrators

Mailgun signs every webhook and route forward with the account Webhook Signing Key. The receiver computes HMAC-SHA256 over timestamp joined to token and compares it with signature. A 406 response rejects a request for good, and other errors are retried for about eight hours. The receiver checks every request. On the Krokul side, the Mailgun message ID can live as an external key of the activity, and the Krokul delivery log replays a step that failed.

[API documentation](https://app.krokul.com/api/v1/docs)

## Questions and answers

### Does Krokul integrate with Mailgun?

Yes. Krokul integrates with Mailgun through the Krokul app in Zapier, Make and n8n and through its API and webhooks, for template sends, delivery events and client replies.

### How does a Mailgun event find the right deal?

Krokul attaches the deal UUID as the v:deal_uuid parameter of every message. Mailgun returns it in user-variables with each webhook, so the event lands on the deal that sent the e-mail.

### Can client replies to a Mailgun e-mail reach Krokul?

Yes. A Mailgun route forwards replies to Krokul with stripped-text, so the comment on the deal holds the new answer without the quoted thread.

### What happens after a permanent failure?

Mailgun does not retry a permanent_fail. Krokul marks the contact, opens a task to fix the address and skips the contact in later sends from the same rule.

## Limits

Sending domains, DNS records, templates and IP reputation are managed in Mailgun. Mailgun shows custom variables to the recipient in a message header and cuts them above 4 KB in events, so Krokul passes only record IDs there.

## Related services

- [SendGrid](https://krokul.com/en/integrations/sendgrid/index.md)
- [Postmark](https://krokul.com/en/integrations/postmark/index.md)
- [Brevo](https://krokul.com/en/integrations/brevo/index.md)
- [Mailchimp](https://krokul.com/en/integrations/mailchimp/index.md)
- [SendPulse](https://krokul.com/en/integrations/sendpulse/index.md)

[Email marketing](https://krokul.com/en/integrations/category/email-marketing/index.md)

Mailgun is a trademark of Mailgun Technologies, Inc. Krokul is not affiliated with Mailgun.

Updated: 2026-10-15

---

App: https://app.krokul.com/ · API: https://app.krokul.com/api/v1/docs
