{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/transmitly-io/json-schema/transmitly-io-automation-input-schema.json",
  "title": "AutomationInput",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/transmitly-io-automations-api-openapi.yml#/components/schemas/AutomationInput",
  "type": "object",
  "required": [
    "name",
    "audience_id",
    "from",
    "steps"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "audience_id": {
      "type": "string"
    },
    "from": {
      "type": "string"
    },
    "from_name": {
      "type": "string"
    },
    "topic": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AutomationStep"
      }
    },
    "trigger": {
      "type": "string",
      "enum": [
        "audience_join",
        "link_clicked",
        "contact_updated",
        "inbound_email",
        "inbound_route"
      ],
      "default": "audience_join"
    },
    "trigger_url": {
      "type": "string",
      "description": "Substring match for tracked click URLs; empty matches any click"
    }
  },
  "$defs": {
    "AutomationStep": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "position": {
          "type": "integer"
        },
        "kind": {
          "type": "string",
          "enum": [
            "wait",
            "send",
            "route"
          ]
        },
        "delay_minutes": {
          "type": "integer"
        },
        "subject": {
          "type": "string"
        },
        "html": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "template_id": {
          "type": "string"
        },
        "condition": {
          "$ref": "#/$defs/StepCondition"
        },
        "on_match_automation_id": {
          "type": "string"
        },
        "on_miss_automation_id": {
          "type": "string"
        },
        "on_match_step": {
          "type": "integer",
          "description": "Later step index in the same automation; -1 means no nested jump"
        },
        "on_miss_step": {
          "type": "integer",
          "description": "Later step index in the same automation; -1 means no nested jump"
        }
      }
    },
    "StepCondition": {
      "type": "object",
      "properties": {
        "attribute_key": {
          "type": "string"
        },
        "attribute_value": {
          "type": "string"
        },
        "opened_within_days": {
          "type": "integer",
          "minimum": 0,
          "maximum": 365
        },
        "clicked_within_days": {
          "type": "integer",
          "minimum": 0,
          "maximum": 365
        }
      }
    }
  }
}