{
  "schema": "mailguard-integration-template/v1",
  "platform": "zapier",
  "title": "MailGuard alert → Slack channel",
  "description": "When MailGuard fires a critical alert on any of your domains, post a formatted message to a Slack channel of your choice.",
  "author": "MailGuard team",
  "license": "MIT",
  "documentation_url": "https://themailguard.ai/integrations/zapier-alert-to-slack",
  "mailguard_api_version": "v1",
  "trigger": {
    "app": "Webhooks by Zapier",
    "event": "Catch Hook",
    "notes": "Generates a unique Catch Hook URL. Paste this URL into MailGuard at Settings → Webhooks → Add endpoint. Subscribe to event: alert.created."
  },
  "steps": [
    {
      "name": "Filter — only critical severity",
      "app": "Filter by Zapier",
      "config": {
        "field": "data.severity",
        "operator": "(Text) Exactly matches",
        "value": "critical"
      }
    },
    {
      "name": "Format — Slack message body",
      "app": "Formatter by Zapier",
      "type": "Text",
      "transform": "Default Value",
      "template": ":rotating_light: *MailGuard alert*\n\n*Domain:* {{data.domain.name}}\n*Type:* {{data.alert.type}}\n*Severity:* {{data.severity}}\n*Summary:* {{data.alert.title}}\n\n<https://themailguard.ai/app/domains/{{data.domain.id}}|Open in MailGuard>"
    },
    {
      "name": "Slack — send channel message",
      "app": "Slack",
      "action": "Send Channel Message",
      "config": {
        "channel": "#mailguard-alerts",
        "message_text": "{{previous_step.output}}",
        "username": "MailGuard",
        "icon_emoji": ":shield:"
      }
    }
  ],
  "setup_steps": [
    "In Zapier, click Create Zap and search 'Webhooks by Zapier' as the trigger. Choose 'Catch Hook'. Copy the Webhook URL Zapier shows you.",
    "In MailGuard, open Settings → Webhooks → Add endpoint. Paste the Zapier URL, give it a name, subscribe to alert.created events. Copy the signing secret if you want to verify signatures.",
    "Back in Zapier, click 'Test trigger'. Trigger a test alert from MailGuard (any check on a misconfigured domain works). Confirm the trigger receives the payload.",
    "Add the Filter step and configure it to only continue when data.severity equals 'critical'.",
    "Add the Formatter step and paste the message template.",
    "Add the Slack step. Connect your workspace, choose the destination channel, and use the formatter output as the message body.",
    "Turn the Zap on."
  ],
  "test_payload_url": "https://api.themailguard.ai/v1/webhooks/test"
}
