{
  "$id": "https://intentschema.org/intents/communication/chat/message/send/v1.json",
  "fqdn": "org.intentschema.communication.chat.message.send.v1",
  "title": "Send chat message",
  "description": "Post a chat message to a channel, DM, or thread.",
  "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",
          "text"
        ],
        "properties": {
          "channel_id": {
            "type": "string",
            "description": "Channel or DM identifier."
          },
          "thread_id": {
            "type": "string",
            "description": "Optional parent message id to reply in-thread."
          },
          "text": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "https://intentschema.org/common/blob-ref/v1.json"
            }
          }
        }
      },
      "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"
      },
      "channel_id": {
        "type": "string"
      },
      "posted_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  },
  "examples": [
    {
      "name": "post to a channel",
      "value": {
        "target": {
          "system": "slack"
        },
        "object": {
          "channel_id": "C0123456",
          "text": "Standup notes ready."
        }
      }
    }
  ]
}
