{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postzen-dev/json-schema/postzen-dev-contact-channel-schema.json",
  "title": "ContactChannel",
  "description": "One platform identity on one connected account. At most 20 channels per contact; optional fields are present as null.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postzen-dev-openapi.json#/components/schemas/ContactChannel",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Contact channel id."
    },
    "contactId": {
      "type": "string",
      "description": "Contact owning this channel."
    },
    "accountId": {
      "type": "string",
      "description": "Connected account id; must belong to the same profile and caller."
    },
    "platform": {
      "type": "string",
      "description": "PostZen platform. Always resolved from the connected account.",
      "enum": [
        "x",
        "instagram",
        "tiktok",
        "linkedin",
        "facebook",
        "youtube",
        "threads",
        "pinterest",
        "bluesky",
        "telegram"
      ]
    },
    "platformIdentifier": {
      "type": "string",
      "description": "Platform identity (IGSID, PSID, or handle), trimmed, 1–200 characters. Unique per connected account.",
      "minLength": 1,
      "maxLength": 200
    },
    "displayIdentifier": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional username or friendly handle, at most 200 characters.",
      "maxLength": 200
    },
    "isSubscribed": {
      "type": "boolean",
      "description": "Channel opt-in. False prevents comment automation sends on this channel.",
      "default": true
    },
    "conversationId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Platform conversation id when known; not the PostZen inbox document id."
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "description": "Optional platform facts; same key and scalar value limits as customFields.",
      "maxProperties": 50,
      "propertyNames": {
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^(?![$_])[\\x20-\\x7e]+$"
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string",
            "maxLength": 1000
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "lastActiveAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Latest counted message time on this channel.",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "description": "Channel creation time.",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "contactId",
    "accountId",
    "platform",
    "platformIdentifier",
    "displayIdentifier",
    "isSubscribed",
    "conversationId",
    "metadata",
    "lastActiveAt",
    "createdAt"
  ]
}