{
  "$id": "https://intentschema.org/intents/communication/chat/file/upload/v1.json",
  "fqdn": "org.intentschema.communication.chat.file.upload.v1",
  "title": "Upload chat file",
  "description": "Upload a file to a channel or DM, optionally with comment.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target",
      "object"
    ],
    "properties": {
      "target": {
        "$ref": "https://intentschema.org/common/target/v1.json"
      },
      "object": {
        "type": "object",
        "required": [
          "channel_id",
          "file"
        ],
        "properties": {
          "channel_id": {
            "type": "string"
          },
          "thread_id": {
            "type": "string"
          },
          "file": {
            "$ref": "https://intentschema.org/common/blob-ref/v1.json"
          },
          "comment": {
            "type": "string"
          }
        }
      },
      "idempotency_key": {
        "type": "string"
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "external_id",
      "created_at"
    ],
    "properties": {
      "external_id": {
        "type": "string",
        "description": "Provider-assigned id."
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "url": {
        "type": "string",
        "format": "uri"
      }
    }
  },
  "examples": [
    {
      "name": "upload PDF",
      "value": {
        "target": {
          "system": "slack"
        },
        "object": {
          "channel_id": "C0123456",
          "file": {
            "url": "https://files.example.com/q3.pdf",
            "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "filename": "q3.pdf",
            "mime_type": "application/pdf"
          }
        }
      }
    }
  ]
}
