Push GitHub Leads to Mailgun

Connect GitLeads to Mailgun to trigger transactional emails to developer leads captured from GitHub star and keyword signals. Step-by-step setup with code examples.

Published: May 7, 2026Updated: May 7, 20267 min read

Why Route GitHub Leads to Mailgun

Mailgun is a transactional email API built for developers. Teams using Mailgun for product emails — activation, onboarding, billing notifications — can extend it to outreach by routing GitLeads signals directly to Mailgun. When a developer stars a tracked repo or mentions your target keywords in a GitHub issue, GitLeads captures that signal and pushes the enriched lead profile to Mailgun via webhook, triggering a personalized email in seconds.

What GitLeads Sends to Mailgun

GitLeads enriches each GitHub signal with: name, email (if public), GitHub username, profile URL, bio, company, location, follower count, top languages, and the signal context (which repo was starred, or which keyword was mentioned). This data arrives via webhook and can be used to personalize Mailgun templates.

Setting Up the GitLeads → Mailgun Integration

  1. Log in to gitleads.app and navigate to Integrations
  2. Select Webhook as your destination
  3. Set the webhook URL to your server endpoint that will process the payload and call Mailgun
  4. In GitLeads, configure your tracked repos and keyword signals
  5. Use the Mailgun Messages API to send personalized emails from your server

Example: GitLeads Webhook → Mailgun Messages API

import express from 'express';
import FormData from 'form-data';
import Mailgun from 'mailgun.js';

const app = express();
app.use(express.json());

const mailgun = new Mailgun(FormData);
const mg = mailgun.client({
  username: 'api',
  key: process.env.MAILGUN_API_KEY!,
});

app.post('/webhook/gitleads', async (req, res) => {
  const lead = req.body;

  // Only email leads with a public email
  if (!lead.email) {
    return res.json({ skipped: true });
  }

  const signalContext =
    lead.signal.type === 'stargazer'
      ? `starred ${lead.signal.repo} on GitHub`
      : `mentioned "${lead.signal.keyword}" in a GitHub issue`;

  await mg.messages.create(process.env.MAILGUN_DOMAIN!, {
    from: 'Your Name <you@yourcompany.com>',
    to: [lead.email],
    subject: `Saw you ${signalContext}`,
    text: `Hi ${lead.name || lead.github_username},

I noticed you ${signalContext}. We help teams like yours with [your value prop].

Would a quick 15-minute call make sense?

Best,
Your Name`,
    'h:X-Lead-Source': 'gitleads',
    'h:X-GitHub-Username': lead.github_username,
  });

  res.json({ sent: true });
});

app.listen(3000);

Filtering Leads Before Emailing

Not every GitHub signal warrants an email. Before triggering Mailgun, filter on: email present (public GitHub email), top_languages matching your ICP (e.g., TypeScript, Go, Rust), follower count above a threshold (e.g., 50+), and company field present. This keeps your Mailgun sending reputation clean and your reply rates high.

function shouldEmail(lead: GitLeadsPayload): boolean {
  if (!lead.email) return false;
  if (!lead.top_languages?.some(l =>
    ['TypeScript', 'Go', 'Rust', 'Python'].includes(l)
  )) return false;
  if ((lead.followers ?? 0) < 50) return false;
  return true;
}

Mailgun Templates for Developer Outreach

Mailgun supports Handlebars templates stored in your account. Store your outreach template in Mailgun and reference it by name in the API call. Use template variables to inject the signal context, repo name, and lead details for personalization at scale.

await mg.messages.create(process.env.MAILGUN_DOMAIN!, {
  from: 'You <you@yourcompany.com>',
  to: [lead.email],
  template: 'github-signal-outreach',
  'h:X-Mailgun-Variables': JSON.stringify({
    name: lead.name || lead.github_username,
    signal_context: signalContext,
    repo: lead.signal.repo,
    company: lead.company || 'your team',
  }),
});
GitLeads captures GitHub developer buying signals — stargazers, keyword mentions in issues and PRs — and pushes enriched profiles to your webhook in real time. Route them to Mailgun, HubSpot, Clay, or any tool in your stack. We find the leads; you handle outreach. Start free at [gitleads.app](https://gitleads.app). Related: [push GitHub leads to HubSpot](/blog/push-github-leads-to-hubspot), [push GitHub leads to Instantly](/blog/push-github-leads-to-instantly), [find Node.js developer leads](/blog/find-node-developer-leads).

Want more like this? Get the weekly developer lead playbook.

No spam. 5 emails over 2 weeks. Unsubscribe anytime.

Related Articles

How to Find Leads on GitHub: The Complete Guide (2026)
10 min read
GitHub Leads vs LinkedIn Leads: When to Use Which (2026)
9 min read
GDPR Compliance for GitHub Lead Scraping: What You Must Know
8 min read