{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whatsapp/json-schema/whatsapp-marketing-message-request-payload-schema.json",
  "title": "MarketingMessageRequestPayload",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whatsapp-marketing-messages-api-openapi.yml#/components/schemas/MarketingMessageRequestPayload",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "messaging_product": {
      "type": "string",
      "description": "Messaging service used. Must be \"whatsapp\"",
      "enum": [
        "whatsapp"
      ]
    },
    "recipient_type": {
      "type": "string",
      "description": "Type of recipient. Must be \"individual\"",
      "enum": [
        "individual"
      ]
    },
    "to": {
      "type": "string",
      "description": "WhatsApp ID or phone number of the message recipient"
    },
    "type": {
      "type": "string",
      "description": "Type of message. Must be \"template\" for marketing messages",
      "enum": [
        "template"
      ],
      "const": "template"
    },
    "template": {
      "$ref": "#/$defs/TemplateObject"
    },
    "product_policy": {
      "type": "string",
      "description": "Optional product policy setting",
      "enum": [
        "CLOUD_API_FALLBACK",
        "STRICT"
      ]
    },
    "message_activity_sharing": {
      "type": "boolean",
      "description": "Optional flag to control message activity sharing"
    }
  },
  "required": [
    "messaging_product",
    "recipient_type",
    "to",
    "type",
    "template"
  ],
  "$defs": {
    "LanguageObject": {
      "type": "object",
      "required": [
        "policy",
        "code"
      ],
      "properties": {
        "policy": {
          "type": "string",
          "description": "The language policy the message should follow.",
          "enum": [
            "deterministic"
          ]
        },
        "code": {
          "type": "string",
          "description": "The code of the language or locale to use (e.g., `\"en\"`, `\"en_US\"`)."
        }
      }
    },
    "TemplateComponent": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Describes the component type.",
          "enum": [
            "header",
            "body",
            "button"
          ]
        },
        "sub_type": {
          "type": "string",
          "description": "Required when `type=button`. Not used for other types. Type of button to create.",
          "enum": [
            "quick_reply",
            "url",
            "catalog"
          ]
        },
        "parameters": {
          "type": "array",
          "description": "Array of parameter objects with the content of the message."
        },
        "index": {
          "type": "string",
          "description": "Required when `type=button`. Not used for other types. Position index of the button (0-9).",
          "pattern": "^[2-6, 11-14]$"
        }
      }
    },
    "TemplateObject": {
      "type": "object",
      "required": [
        "name",
        "language"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the template."
        },
        "language": {
          "$ref": "#/$defs/LanguageObject",
          "description": "Contains a `language` object. Specifies the language the template may be rendered in"
        },
        "components": {
          "type": "array",
          "description": "Array of `components` objects containing the parameters of the message.",
          "items": {
            "$ref": "#/$defs/TemplateComponent"
          }
        }
      }
    }
  }
}