npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rawdash/connector-mailgun

v0.29.2

Published

Rawdash connector for Mailgun — syncs daily transactional email metrics (accepted, delivered, failed, opens, clicks, unsubscribes, complaints) and recent delivery events via the Mailgun Analytics API

Readme

@rawdash/connector-mailgun

npm version license

Sync transactional email volume, delivery, bounce, and complaint metrics plus recent delivery events from Mailgun.

Install

npm install @rawdash/connector-mailgun

Authentication

A Mailgun API key with read access to analytics, sent via HTTP basic auth (username api, password is the key).

  1. In the Mailgun dashboard open Settings -> API Keys and create or copy an API key with analytics read access.
  2. Note which region hosts your domain (US or EU); set the connector region accordingly.
  3. Store the key as a secret and reference it from the connector config as apiKey: secret("MAILGUN_API_KEY"), and set domain to the sending domain you want to report on.

Configuration

| Field | Type | Required | Description | | -------------- | ------------ | -------- | ---------------------------------------------------------------------------------------------------------------- | | apiKey | secret | Yes | A Mailgun API key with read access to analytics. Create one in the Mailgun dashboard under Settings -> API Keys. | | domain | string | Yes | The Mailgun sending domain to report on (e.g. mg.example.com). Metrics and logs are filtered to this domain. | | region | us | eu | No | Which Mailgun region hosts the domain. 'us' uses api.mailgun.net; 'eu' uses api.eu.mailgun.net. | | lookbackDays | number | No | How many calendar days of stats/events to fetch on a full sync. Defaults to 90. | | resources | array | No | Which Mailgun resources to sync. Omit to sync all of them. |

Resources

  • mailgun_email_stats (metric) - Daily transactional email volume and engagement for the configured domain. The canonical value is accepted (messages accepted for sending); delivery, failure, and engagement counts are carried as measures.
    • Endpoint: POST /v1/analytics/metrics
    • Unit: emails
    • Granularity: day
    • Dimensions: date, domain
    • Measures: delivered, failed, opened, clicked, unsubscribed, complained
  • mailgun_event (event) - Recent per-message delivery events (accepted, delivered, failed, opened, clicked, unsubscribed, complained) for the configured domain. Deduplicated by Mailgun event id.
    • Endpoint: POST /v1/analytics/logs
    • A bounded sample of the most recent logs is stored; Mailgun retains log data for a limited period.
    • eventId: Mailgun event id (stable per event).
    • eventType: Event type (accepted, delivered, failed, opened, clicked, unsubscribed, complained).
    • recipient: Recipient email address.
    • domain: The Mailgun sending domain.
    • severity: Failure severity, when present.
    • reason: Failure reason, when present.

Example

import {
  defineConfig,
  defineDashboard,
  defineMetric,
  secret,
} from '@rawdash/core';

const mailgun = {
  name: 'mailgun',
  connectorId: 'mailgun',
  config: {
    apiKey: secret('MAILGUN_API_KEY'),
    domain: 'mg.example.com',
    region: 'us' as const,
    lookbackDays: 90,
  },
};

export default defineConfig({
  connectors: [mailgun],
  dashboards: {
    email: defineDashboard({
      widgets: {
        sends_30d: {
          kind: 'stat',
          title: 'Emails sent (30d)',
          window: '30d',
          metric: defineMetric({
            connector: mailgun,
            shape: 'metric',
            name: 'mailgun_email_stats',
            field: 'value',
            fn: 'sum',
          }),
        },
        daily_sends: {
          kind: 'timeseries',
          title: 'Daily email volume',
          window: '30d',
          metric: defineMetric({
            connector: mailgun,
            shape: 'metric',
            name: 'mailgun_email_stats',
            field: 'value',
            fn: 'sum',
          }),
        },
      },
    }),
  },
});

Rate limits

Mailgun applies per-endpoint rate limits and returns 429 with a Retry-After header when exceeded; the shared HTTP client backs off and retries automatically.

Limitations

  • Metrics are reported at daily resolution; the connector requests resolution=day from the analytics API.
  • Incremental syncs re-fetch a fixed trailing window and replace only that window, so older samples are preserved.
  • The events resource stores a bounded sample of the most recent delivery logs (Mailgun retains log data for a limited period), not a complete event archive.

Links

License

Apache-2.0