This workflow processes webhook requests to send localized welcome emails based on user IP location using Mailgun and IP-API. Key nodes include Webhook Trigger (receives requests), Process Request (extracts IP and email), Get Location by IP (fetches location via IP-API), Determine Language (selects English or Spanish), Language Router (directs email type), Send Spanish/English Email (sends via Mailgun), and Success Response (returns status). It uses IP-API for location data and Mailgun for email delivery.\n\nSetup Requirements: Install n8n from n8n.io or sign up at cloud.n8n.io. Import the JSON into n8n’s workflow editor. Configure Webhook Trigger with path geo-email and HTTP method POST. Obtain Mailgun API key and domain from mailgun.com (Domains > API Keys). In n8n, go to Credentials, add Mailgun (HTTP Basic Auth, API key as password, domain as specified). No credentials are needed for IP-API as it’s a public API. Ensure Process Request validates email field. Handle errors like invalid email (400: Valid email address is required) or incorrect Mailgun credentials (401: Unauthorized). Set up your application to send POST requests with ip, email, name, and optional language fields.\n\nTesting and Deployment: Import the JSON into n8n. Test with curl -X POST http://your-n8n-instance/geo-email -d '{"email":"test@example.com","name":"Test","ip":"8.8.8.8"}'. Verify Get Location by IP returns country, city, and countryCode. Check Determine Language selects es for Spanish-speaking countries (e.g., MX) or en otherwise. Confirm Send Spanish Email or Send English Email delivers the correct localized email. Validate Success Response returns {"status":"success","language":"en"} or es. Test with invalid email ({"email":"invalid"}) to trigger {"error":"Valid email address is required"}. Simulate Spanish override with {"email":"test@example.com","language":"es"}. Monitor logs for issues like Mailgun rate limits (429) or IP-API timeouts (503: Service Unavailable). If emails fail, verify Mailgun API key and domain. Activate the workflow in n8n and integrate the webhook URL into your application. Deploy for automated, location-based email delivery.
$5.49
Workflow steps: 8
Integrated apps: webhook, code, httpRequest