-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(mailgun): Add EU region support and UI configuration options #5366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added MAILGUN_REGION environment variable (US or EU) - Dynamically select API endpoint based on region - Fixes 401 errors for EU Mailgun accounts
- Remove incorrect files parameter - Use only data parameter for form data - Fix duplicate payload passing - Resolves 400 bad request errors
- Added api_region field to MailgunProviderAuthConfig with US/EU dropdown - Hybrid approach: UI field takes priority, falls back to MAILGUN_REGION env var - Maintains backward compatibility with environment variable configuration - Allows per-provider region configuration when needed
@sanyo4ever is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
|
No linked issues found. Please add the corresponding issues in the pull request description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @sanyo4ever Can you execute |
10c1d16
to
6a0a324
Compare
🎯 Overview
This PR enhances the Mailgun provider for self-hosted Keep instances with:
🐛 Problems Solved
Issue 1: EU Region Not Supported
The Mailgun API endpoint was hardcoded to
https://api.mailgun.net
(US region only). Users with EU Mailgun accounts received 401/400 errors when installing the provider.Issue 2: Incorrect API Request Format
The
setup_webhook()
method was passing bothfiles
anddata
parameters torequests.post()
, causing "400 Bad Request" errors from Mailgun API.Issue 3: No UI Control for Region
Users had to modify code or use environment variables. No per-provider region configuration was possible.
✨ Solution
1. UI Dropdown for Region Selection
Added
api_region
field toMailgunProviderAuthConfig
with dropdown:2. Hybrid Configuration Priority
Benefits:
MAILGUN_REGION
environment variable3. API Endpoint Selection
Dynamically selects the correct API endpoint:
https://api.mailgun.net
https://api.eu.mailgun.net
4. API Request Format Fix
Before (Broken):
After (Fixed):
🧪 Testing
📊 Changes
Files Modified:
keep/providers/mailgun_provider/mailgun_provider.py
api_region
field with dropdown (lines 49-59)MAILGUN_REGION
class variable (line 74)setup_webhook()
(lines 231-259)🔄 Backward Compatibility
MAILGUN_REGION
still works💡 Usage Examples
Example 1: UI Configuration (Per-Provider)