{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/reeldrop-io/json-schema/reeldrop-io-automation-out-schema.json",
  "title": "AutomationOut",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/reeldrop-io-openapi.json#/components/schemas/AutomationOut",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "workspace_id": {
      "type": "string",
      "title": "Workspace Id"
    },
    "ig_user_id": {
      "type": "string",
      "title": "Ig User Id"
    },
    "name": {
      "type": "string",
      "title": "Name"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "trigger": {
      "$ref": "#/$defs/AutomationTrigger"
    },
    "actions": {
      "items": {
        "$ref": "#/$defs/AutomationAction"
      },
      "type": "array",
      "title": "Actions"
    },
    "opening_message": {
      "$ref": "#/$defs/OpeningMessage"
    },
    "ask_for_follow": {
      "type": "boolean",
      "title": "Ask For Follow"
    },
    "follow_gate_message": {
      "type": "string",
      "title": "Follow Gate Message"
    },
    "follow_gate_button_label": {
      "type": "string",
      "title": "Follow Gate Button Label"
    },
    "follow_gate_quick_replies": {
      "items": {
        "$ref": "#/$defs/QuickReply"
      },
      "type": "array",
      "title": "Follow Gate Quick Replies"
    },
    "follow_up": {
      "$ref": "#/$defs/AutomationFollowUp"
    },
    "ai": {
      "$ref": "#/$defs/AiDmConfig"
    },
    "typing_indicator": {
      "type": "boolean",
      "title": "Typing Indicator"
    },
    "stats": {
      "$ref": "#/$defs/AutomationStats"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "public_reply_usage": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Public Reply Usage"
    },
    "ice_breakers_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ice Breakers Synced At"
    },
    "ice_breakers_sync_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ice Breakers Sync Error"
    },
    "stalled": {
      "anyOf": [
        {
          "$ref": "#/$defs/AutomationStall"
        },
        {
          "type": "null"
        }
      ]
    },
    "paused_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Paused Reason"
    },
    "deleted_post_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Deleted Post Ids"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Archived At"
    }
  },
  "type": "object",
  "required": [
    "id",
    "workspace_id",
    "ig_user_id",
    "name",
    "status",
    "trigger",
    "actions",
    "opening_message",
    "ask_for_follow",
    "follow_gate_message",
    "follow_gate_button_label",
    "follow_up",
    "ai",
    "typing_indicator",
    "stats",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "AiDmConfig": {
      "properties": {
        "goal": {
          "type": "string",
          "title": "Goal",
          "default": ""
        },
        "context": {
          "type": "string",
          "title": "Context",
          "default": ""
        },
        "exit_condition": {
          "type": "string",
          "title": "Exit Condition",
          "default": ""
        },
        "max_turns": {
          "type": "integer",
          "title": "Max Turns",
          "default": 6
        },
        "inquiries_only": {
          "type": "boolean",
          "title": "Inquiries Only",
          "default": true
        },
        "first_message_enabled": {
          "type": "boolean",
          "title": "First Message Enabled",
          "default": false
        },
        "first_message": {
          "type": "string",
          "title": "First Message",
          "default": ""
        },
        "handoff_message": {
          "type": "string",
          "title": "Handoff Message",
          "default": ""
        },
        "fallback_message": {
          "type": "string",
          "title": "Fallback Message",
          "default": ""
        },
        "tone": {
          "type": "string",
          "enum": [
            "friendly",
            "professional",
            "playful",
            "concise"
          ],
          "title": "Tone",
          "default": "friendly"
        },
        "link": {
          "type": "string",
          "title": "Link",
          "default": ""
        }
      },
      "type": "object",
      "title": "AiDmConfig",
      "description": "The brief for an ai_dm automation: what the AI is trying to do, what it\nis allowed to know, and where it has to stop.\n\nOnly read when trigger.type == \"ai_dm\". It is stored on every automation\nregardless so that toggling the trigger type in the builder never destroys a\nparagraph of typed context."
    },
    "AutomationAction": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "public_reply",
            "private_dm"
          ],
          "title": "Type"
        },
        "messages": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Messages"
        },
        "buttons": {
          "items": {
            "$ref": "#/$defs/MessageButton"
          },
          "type": "array",
          "title": "Buttons"
        },
        "quick_replies": {
          "items": {
            "$ref": "#/$defs/QuickReply"
          },
          "type": "array",
          "title": "Quick Replies"
        },
        "reply_limit": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reply Limit"
        }
      },
      "type": "object",
      "required": [
        "type"
      ],
      "title": "AutomationAction"
    },
    "AutomationFollowUp": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "default": false
        },
        "delay_seconds": {
          "type": "integer",
          "title": "Delay Seconds",
          "default": 3600
        },
        "message": {
          "type": "string",
          "title": "Message",
          "default": ""
        },
        "quick_replies": {
          "items": {
            "$ref": "#/$defs/QuickReply"
          },
          "type": "array",
          "title": "Quick Replies"
        }
      },
      "type": "object",
      "title": "AutomationFollowUp"
    },
    "AutomationStall": {
      "properties": {
        "reason": {
          "type": "string",
          "title": "Reason"
        },
        "skips": {
          "type": "integer",
          "title": "Skips"
        },
        "last_media_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Media Id"
        },
        "last_at": {
          "type": "string",
          "format": "date-time",
          "title": "Last At"
        }
      },
      "type": "object",
      "required": [
        "reason",
        "skips",
        "last_at"
      ],
      "title": "AutomationStall",
      "description": "Why an active automation is not firing, for the automations list.\n\nWritten by the engine (services/automation_engine._record_skip) and reset\nthe moment the automation matches again, so `skips` reads as \"since this\nlast worked\" rather than as a lifetime total."
    },
    "AutomationStats": {
      "properties": {
        "dms_sent": {
          "type": "integer",
          "title": "Dms Sent",
          "default": 0
        },
        "dms_failed": {
          "type": "integer",
          "title": "Dms Failed",
          "default": 0
        },
        "public_replies_sent": {
          "type": "integer",
          "title": "Public Replies Sent",
          "default": 0
        },
        "events_received": {
          "type": "integer",
          "title": "Events Received",
          "default": 0
        },
        "button_taps": {
          "type": "integer",
          "title": "Button Taps",
          "default": 0
        },
        "replies_received": {
          "type": "integer",
          "title": "Replies Received",
          "default": 0
        },
        "follow_ups_sent": {
          "type": "integer",
          "title": "Follow Ups Sent",
          "default": 0
        },
        "follow_ups_missed_window": {
          "type": "integer",
          "title": "Follow Ups Missed Window",
          "default": 0
        },
        "ai_replies_sent": {
          "type": "integer",
          "title": "Ai Replies Sent",
          "default": 0
        },
        "ai_conversations": {
          "type": "integer",
          "title": "Ai Conversations",
          "default": 0
        },
        "ai_handoffs": {
          "type": "integer",
          "title": "Ai Handoffs",
          "default": 0
        },
        "ai_failures": {
          "type": "integer",
          "title": "Ai Failures",
          "default": 0
        },
        "ai_replies_skipped": {
          "type": "integer",
          "title": "Ai Replies Skipped",
          "default": 0
        },
        "ai_quota_blocks": {
          "type": "integer",
          "title": "Ai Quota Blocks",
          "default": 0
        },
        "ai_link_violations": {
          "type": "integer",
          "title": "Ai Link Violations",
          "default": 0
        }
      },
      "type": "object",
      "title": "AutomationStats"
    },
    "AutomationTrigger": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "comment",
            "live_comment",
            "dm",
            "story_reply",
            "ai_dm",
            "ice_breaker",
            "reel_share"
          ],
          "title": "Type"
        },
        "post_target": {
          "type": "string",
          "enum": [
            "all",
            "specific",
            "scheduled",
            "attach_later"
          ],
          "title": "Post Target",
          "default": "all"
        },
        "post_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Post Ids"
        },
        "keywords": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Keywords"
        },
        "keyword_match": {
          "type": "string",
          "enum": [
            "exact",
            "contains",
            "any"
          ],
          "title": "Keyword Match",
          "default": "contains"
        },
        "ice_breakers": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Ice Breakers"
        },
        "ice_breaker_replies": {
          "items": {
            "$ref": "#/$defs/IceBreakerReply"
          },
          "type": "array",
          "title": "Ice Breaker Replies"
        }
      },
      "type": "object",
      "required": [
        "type"
      ],
      "title": "AutomationTrigger"
    },
    "IceBreakerReply": {
      "properties": {
        "messages": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Messages"
        },
        "buttons": {
          "items": {
            "$ref": "#/$defs/MessageButton"
          },
          "type": "array",
          "title": "Buttons"
        },
        "quick_replies": {
          "items": {
            "$ref": "#/$defs/QuickReply"
          },
          "type": "array",
          "title": "Quick Replies"
        }
      },
      "type": "object",
      "title": "IceBreakerReply",
      "description": "The DM one ice breaker question sends when tapped — the same text +\nbuttons shape as a private_dm action, scoped to a single question."
    },
    "MessageButton": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "web_url",
            "postback"
          ],
          "title": "Type",
          "default": "web_url"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "url": {
          "type": "string",
          "title": "Url",
          "default": ""
        },
        "payload": {
          "type": "string",
          "title": "Payload",
          "default": ""
        },
        "kind": {
          "type": "string",
          "enum": [
            "link",
            "pdf",
            "cards"
          ],
          "title": "Kind",
          "default": "link"
        },
        "asset_key": {
          "type": "string",
          "title": "Asset Key",
          "default": ""
        },
        "asset_name": {
          "type": "string",
          "title": "Asset Name",
          "default": ""
        },
        "cards": {
          "items": {
            "$ref": "#/$defs/MessageCard"
          },
          "type": "array",
          "title": "Cards"
        }
      },
      "type": "object",
      "required": [
        "title"
      ],
      "title": "MessageButton"
    },
    "MessageCard": {
      "properties": {
        "title": {
          "type": "string",
          "title": "Title"
        },
        "subtitle": {
          "type": "string",
          "title": "Subtitle",
          "default": ""
        },
        "image_url": {
          "type": "string",
          "title": "Image Url",
          "default": ""
        },
        "button_title": {
          "type": "string",
          "title": "Button Title",
          "default": "Link"
        },
        "url": {
          "type": "string",
          "title": "Url",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "title"
      ],
      "title": "MessageCard",
      "description": "One element of a generic-template carousel — an image, a title, and one\nlink button. Delivered when the user taps a `kind=\"cards\"` button on the DM\ncard (a postback), never pushed unprompted."
    },
    "OpeningMessage": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "default": false
        },
        "text": {
          "type": "string",
          "title": "Text",
          "default": ""
        },
        "button_label": {
          "type": "string",
          "title": "Button Label",
          "default": "Send me the link"
        },
        "quick_replies": {
          "items": {
            "$ref": "#/$defs/QuickReply"
          },
          "type": "array",
          "title": "Quick Replies"
        }
      },
      "type": "object",
      "title": "OpeningMessage",
      "description": "Gated flow: send this card with a tappable button; deliver the private_dm only on tap."
    },
    "QuickReply": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "email",
            "phone"
          ],
          "title": "Type",
          "default": "text"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "ask_text": {
          "type": "string",
          "title": "Ask Text",
          "default": ""
        },
        "reply_messages": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reply Messages"
        },
        "reply_buttons": {
          "items": {
            "$ref": "#/$defs/MessageButton"
          },
          "type": "array",
          "title": "Reply Buttons"
        }
      },
      "type": "object",
      "required": [
        "title"
      ],
      "title": "QuickReply",
      "description": "One chip under a DM.\n\nA `text` chip answers with its own reply when it has one. Without one, a chip\non the opening message or the follow gate moves the flow on exactly as that\nstep's button does, and a chip anywhere else is only recorded.\n\n`email` and `phone` are ask-and-capture chips. Meta's native user_email and\nuser_phone_number quick replies are disabled on Instagram (\"Requests that use\nuser_phone_number or user_email will not create contact-information quick\nreplies\"), so these go out as plain text chips too: the tap sends `ask_text`,\nand the person's next message is validated and saved on their inbox contact\nbefore the reply (or the next step) follows."
    }
  }
}