{
  "$id": "https://intentschema.org/intents/communication/email/message/read/v1.json",
  "fqdn": "org.intentschema.communication.email.message.read.v1",
  "title": "Read email message",
  "description": "Read a single email message by id, including headers and body.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "external_id"
    ],
    "properties": {
      "external_id": {
        "type": "string"
      },
      "object": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string"
          },
          "thread_id": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "email",
            "description": "RFC 5321 mailbox. Plain address (jane@example.com) or with display name (\"Jane Doe\" <jane@example.com>)."
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "description": "RFC 5321 mailbox. Plain address (jane@example.com) or with display name (\"Jane Doe\" <jane@example.com>)."
            }
          },
          "subject": {
            "type": "string"
          },
          "snippet": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "is_unread": {
            "type": "boolean"
          },
          "has_attachments": {
            "type": "boolean"
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "etag": {
        "type": "string"
      }
    }
  },
  "examples": [
    {
      "name": "fetch by id",
      "value": {
        "target": {
          "system": "gmail",
          "external_id": "msg_abc123"
        }
      }
    }
  ]
}
