{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postzen-dev/json-schema/postzen-dev-webhook-write-response-schema.json",
  "title": "WebhookWriteResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postzen-dev-webhooks-api-openapi.yml#/components/schemas/WebhookWriteResponse",
  "type": "object",
  "required": [
    "message",
    "webhook"
  ],
  "properties": {
    "message": {
      "type": "string"
    },
    "webhook": {
      "$ref": "#/$defs/Webhook"
    }
  },
  "$defs": {
    "Webhook": {
      "type": "object",
      "required": [
        "id",
        "name",
        "url",
        "events",
        "profileAccess",
        "profileIds",
        "hasSigningSecret",
        "customHeaderNames",
        "isActive",
        "consecutiveFailures",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "events": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/WebhookEvent"
          }
        },
        "profileAccess": {
          "type": "string",
          "enum": [
            "all_profiles",
            "selected_profiles"
          ]
        },
        "profileIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Selected profile ids. Empty when profileAccess is all_profiles."
        },
        "hasSigningSecret": {
          "type": "boolean",
          "description": "Whether PostZen signs deliveries for this endpoint. The secret itself is never returned."
        },
        "customHeaderNames": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Configured custom header names. Header values are never returned."
        },
        "isActive": {
          "type": "boolean"
        },
        "disabledReason": {
          "type": "string",
          "enum": [
            "auto_consecutive_failures",
            "user_disabled"
          ]
        },
        "consecutiveFailures": {
          "type": "integer",
          "minimum": 0
        },
        "lastDeliveredAt": {
          "type": "string",
          "format": "date-time"
        },
        "lastFailedAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "WebhookEvent": {
      "type": "string",
      "enum": [
        "post.scheduled",
        "post.published",
        "post.partially_failed",
        "post.failed",
        "post.cancelled",
        "post.platform.published",
        "post.platform.failed",
        "post.external.created",
        "account.connected",
        "account.needs_reauth",
        "account.disconnected",
        "analytics.synced",
        "conversation.started",
        "message.received",
        "message.sent",
        "comment.received",
        "contact.tag_added",
        "contact.tag_removed",
        "contact.field_changed",
        "webhook.test"
      ],
      "description": "Webhook event type. See the Webhook Events section for each event's trigger and payload. Receivers should tolerate additional event types in future API versions."
    }
  }
}