Routes

Table of contents

  1. Name
  2. Endpoint
  3. Rule & Pipeline (JSON)
  4. Author routes with an AI agent

Name

Friendly name for a route

Endpoint

Select pre-defined Endpoint.

Rule & Pipeline (JSON)

Both rule and pipeline defined using JSON for now.

Schema defines both Rules and a Pipeline.

To draft or review the JSON with your coding agent, use the MailWebhook agent skill.

Default schema pre-filled for new routes (see below). map.generic_json pipeline transforms email into default deterministic shape.

Pipeline reminders:

  • pipeline.steps must contain at least one step.
  • Exactly one map.* step must exist.
  • The map.* step must be the final step.
  • Chat mappers use provider-specific destination arguments such as channel for Slack and chat_id for Telegram.
{
  "rule": {
    "to_contains": [],
    "from_domains": [],
    "subject_contains": [],
    "headers_equals": {}
  },
  "pipeline": {
    "steps": [
      {
        "name": "map.generic_json",
        "args": {}
      }
    ]
  }
}

Author routes with an AI agent

The MailWebhook agent skill, author-mailwebhook-route-json, helps your coding agent write, explain, review, and repair matching rules, transform pipelines, and Custom JSON mappers. It can return a complete route configuration or just the rule, pipeline, or mapper you need.

With Node.js and npm installed, run this from your project directory:

npx skills add mailwebhookhq/agent-skills --skill author-mailwebhook-route-json

Follow the CLI prompts to select your coding agent. See the repository README for agent selection and installation across projects.

Ask your agent to use author-mailwebhook-route-json. Include which emails should match, representative email content, and the JSON your endpoint expects. For updates, include the existing configuration; for a complete API route body, include the destination endpoint ID.

For example, to draft the Rule & Pipeline (JSON) configuration:

Use author-mailwebhook-route-json to build a rule and pipeline for emails
to invoices@example.com from billing@example.com whose subject contains
"Invoice". Emit Custom JSON with message_id, subject, sender, and text.
Return one JSON object containing rule and pipeline for the route editor. Explain
which emails should match and how missing fields are handled.

Review the generated JSON, save it in the route editor, and use Mailbox Preview to check matching and output against representative emails. Then send a test email and inspect the payload. Generating configuration with the skill does not publish a route or send a webhook.


Table of contents