{
  "schema": "mailguard-integration-template/v1",
  "platform": "zapier",
  "title": "New domain in MailGuard → Google Sheets row",
  "description": "Whenever you add a new domain to MailGuard, append a row to a Google Sheet so your team has a live inventory of what's monitored.",
  "author": "MailGuard team",
  "license": "MIT",
  "documentation_url": "https://themailguard.ai/integrations/zapier-domain-to-spreadsheet",
  "mailguard_api_version": "v1",
  "trigger": {
    "app": "Webhooks by Zapier",
    "event": "Catch Hook",
    "notes": "Generates a unique Catch Hook URL. Paste it into MailGuard at Settings → Webhooks → Add endpoint. Subscribe to event: domain.created."
  },
  "steps": [
    {
      "name": "Format — extract row fields",
      "app": "Formatter by Zapier",
      "type": "Utilities",
      "transform": "Pick from List",
      "notes": "Optional. Use this to fall back to 'Unknown' when a field is missing in the payload."
    },
    {
      "name": "Google Sheets — Create Spreadsheet Row",
      "app": "Google Sheets",
      "action": "Create Spreadsheet Row",
      "config": {
        "spreadsheet": "MailGuard Domains Inventory",
        "worksheet": "Domains",
        "row": {
          "Domain": "{{data.domain.name}}",
          "Org": "{{data.org.name}}",
          "Plan": "{{data.org.plan}}",
          "Health Score": "{{data.domain.health_score}}",
          "MX Provider": "{{data.domain.mx_provider}}",
          "Created At": "{{data.domain.created_at}}",
          "MailGuard URL": "https://themailguard.ai/app/domains/{{data.domain.id}}"
        }
      }
    }
  ],
  "setup_steps": [
    "Create a Google Sheet with header row: Domain, Org, Plan, Health Score, MX Provider, Created At, MailGuard URL.",
    "In Zapier, create a Zap with 'Webhooks by Zapier — Catch Hook' as the trigger. Copy the URL Zapier gives you.",
    "In MailGuard, paste the URL into Settings → Webhooks. Subscribe to domain.created.",
    "Add a domain in MailGuard to test the trigger. Confirm Zapier receives a payload.",
    "Add the Google Sheets step. Connect your account, choose the spreadsheet and worksheet, and map the columns to the payload fields.",
    "Turn the Zap on."
  ]
}
