Mailgun Channel Provider

Configuration

The configuration steps are explained in the mailgun configuration page.

Usage

1. When configured with

{
  "api_key": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
  "domain": "example.com",
  "from": {
    "email": "hello@example.com",
    "name": "Example"
  },
  "region": "us"
}

2. With a channel token

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "api_key": {
      "minLength": 1,
      "type": "string"
    },
    "domain": {
      "minLength": 1,
      "type": "string"
    },
    "from": {
      "properties": {
        "email": {
          "description": "The email address to send from",
          "format": "email",
          "type": "string"
        },
        "name": {
          "description": "The name to send from",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "email"
      ],
      "type": "object"
    },
    "region": {
      "enum": [
        "us",
        "eu"
      ],
      "type": "string"
    }
  },
  "required": [
    "api_key",
    "region",
    "domain"
  ],
  "type": "object"
}

3. With Broadcast

{
  "action_url": "https://example.com",
  "category": "example",
  "content": "Hello, World!",
  "custom_attributes": {},
  "id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
  "overrides": {},
  "recipients": [
    {
      "custom_attributes": {
        "plan": "enterprise",
        "preferred_pronoun": "They",
        "pricing_version": "v10"
      },
      "email": "test@example.com",
      "external_id": "83d987a-83fd034",
      "first_name": "Person",
      "last_name": "Doe",
      "phone_numbers": [
        "+1 5005550001"
      ]
    }
  ],
  "title": "Hello, World!",
  "topic": "example"
}

The channel handler triggers a HTTP request

POST https://api.mailgun.net/v3/example.com/messages

With payload

--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c
Content-Disposition: form-data; name="from"

"Example" <hello@example.com>
--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c
Content-Disposition: form-data; name="subject"

Hello, World!
--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c
Content-Disposition: form-data; name="text"

Hello, World!
--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c
Content-Disposition: form-data; name="html"

Hello, World!
--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c
Content-Disposition: form-data; name="to"

dan@example.com
--89a3b3cb61a6f648423fd543650a3299d4fb502a0c1244dabfe5a3c04c3c--