{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://schema.slack.dev/message", "title": "Slack Message", "description": "A Slack message object representing a single message in a conversation. Messages can contain plain text, Block Kit layouts, attachments, files, reactions, and metadata. Each message is uniquely identified by its channel and timestamp (ts) combination. Messages support threading via thread_ts, and can have subtypes indicating specialized message types such as bot_message, channel_join, file_share, etc.", "type": "object", "required": [ "type", "ts" ], "properties": { "type": { "type": "string", "const": "message", "description": "The object type. Always 'message' for message objects." }, "subtype": { "type": "string", "description": "An optional subtype indicating a specialized message type. Common subtypes include: bot_message, channel_join, channel_leave, channel_topic, channel_purpose, channel_name, channel_archive, channel_unarchive, file_share, file_comment, me_message, thread_broadcast, tombstone, reminder_add, pinned_item, unpinned_item, and ekm_access_denied.", "enum": [ "bot_message", "channel_join", "channel_leave", "channel_topic", "channel_purpose", "channel_name", "channel_archive", "channel_unarchive", "file_share", "file_comment", "me_message", "thread_broadcast", "tombstone", "reminder_add", "pinned_item", "unpinned_item", "ekm_access_denied" ] }, "channel": { "type": "string", "description": "The channel ID where the message was posted. Channel IDs begin with C for public channels, G for private channels and multi-person DMs, and D for direct messages.", "pattern": "^[CGDW][A-Z0-9]+$" }, "user": { "type": "string", "description": "The user ID of the message author. User IDs begin with U or W.", "pattern": "^[UW][A-Z0-9]+$" }, "text": { "type": "string", "description": "The text content of the message. Supports Slack mrkdwn formatting including *bold*, _italic_, ~strikethrough~, `code`, ```code blocks```, > blockquotes, and links. Also supports user mentions (<@U1234>), channel references (<#C1234>), and special commands (, , )." }, "ts": { "type": "string", "description": "The unique timestamp identifier for the message, which also serves as the message ID within its channel. Format is Unix epoch seconds with microsecond precision separated by a dot (e.g., '1503435956.000247'). The combination of channel and ts uniquely identifies any message in Slack.", "pattern": "^[0-9]+\\.[0-9]+$" }, "thread_ts": { "type": "string", "description": "The timestamp of the parent message when this message is a threaded reply. If present and equal to ts, this message is the parent of a thread. If present and different from ts, this message is a reply in the thread.", "pattern": "^[0-9]+\\.[0-9]+$" }, "reply_count": { "type": "integer", "description": "The total number of replies in the thread. Only present on the parent message of a thread.", "minimum": 0 }, "reply_users_count": { "type": "integer", "description": "The number of unique users who have replied in the thread. Only present on the parent message.", "minimum": 0 }, "latest_reply": { "type": "string", "description": "The timestamp of the most recent reply in the thread. Only present on the parent message.", "pattern": "^[0-9]+\\.[0-9]+$" }, "reply_users": { "type": "array", "description": "An array of user IDs for users who have replied in the thread. Only present on the parent message. Limited to the most recent 5 reply users by default.", "items": { "type": "string", "pattern": "^[UW][A-Z0-9]+$" } }, "is_locked": { "type": "boolean", "description": "Whether the thread is locked, preventing new replies." }, "subscribed": { "type": "boolean", "description": "Whether the authenticated user is subscribed to this thread." }, "blocks": { "type": "array", "description": "An array of Block Kit layout blocks used for rich message formatting. Blocks can include sections, dividers, images, context, actions, header, input, and other interactive elements. See https://docs.slack.dev/block-kit for the full Block Kit reference.", "items": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "The type of block. Common types include section, divider, image, context, actions, header, input, file, rich_text, and video.", "enum": [ "section", "divider", "image", "context", "actions", "header", "input", "file", "rich_text", "video", "call" ] }, "block_id": { "type": "string", "description": "A unique identifier for the block. If not provided, one will be generated. Maximum 255 characters.", "maxLength": 255 }, "text": { "type": "object", "description": "A text composition object. Used in section, header, and other blocks.", "properties": { "type": { "type": "string", "enum": [ "plain_text", "mrkdwn" ] }, "text": { "type": "string" }, "emoji": { "type": "boolean" }, "verbatim": { "type": "boolean" } } }, "elements": { "type": "array", "description": "An array of interactive elements or text objects within the block.", "items": { "type": "object" } }, "accessory": { "type": "object", "description": "An optional accessory element attached to a section block." }, "fields": { "type": "array", "description": "An array of text objects for multi-column layouts in section blocks. Maximum of 10 items.", "items": { "type": "object" }, "maxItems": 10 } } } }, "attachments": { "type": "array", "description": "An array of secondary message attachments. While Block Kit is the preferred way to build rich messages, attachments are still supported for legacy compatibility and for displaying content below the blocks.", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "A unique identifier for this attachment within the message." }, "color": { "type": "string", "description": "A hex color code used to color the left border of the attachment. Can be 'good' (green), 'warning' (yellow), 'danger' (red), or any hex code.", "pattern": "^(#[0-9a-fA-F]{6}|good|warning|danger)$" }, "fallback": { "type": "string", "description": "A plain text summary of the attachment used in notifications and clients that cannot render formatted text." }, "text": { "type": "string", "description": "The main body text of the attachment." }, "pretext": { "type": "string", "description": "Optional text that appears above the attachment block." }, "author_name": { "type": "string", "description": "Small text used to display the author's name." }, "author_link": { "type": "string", "format": "uri", "description": "A URL that will hyperlink the author_name." }, "author_icon": { "type": "string", "format": "uri", "description": "A URL that displays a small icon beside the author_name." }, "title": { "type": "string", "description": "The title displayed in bold at the top of the attachment." }, "title_link": { "type": "string", "format": "uri", "description": "A URL that will hyperlink the title." }, "fields": { "type": "array", "description": "An array of field objects displayed in a table inside the attachment.", "items": { "type": "object", "properties": { "title": { "type": "string", "description": "The title of the field, shown as a bold heading." }, "value": { "type": "string", "description": "The text value of the field." }, "short": { "type": "boolean", "description": "Whether the field is short enough to display side-by-side with other fields." } } } }, "image_url": { "type": "string", "format": "uri", "description": "A URL to an image to display inside the attachment." }, "thumb_url": { "type": "string", "format": "uri", "description": "A URL to a thumbnail image to display to the right of the attachment." }, "footer": { "type": "string", "description": "Brief text to contextualize and identify the attachment." }, "footer_icon": { "type": "string", "format": "uri", "description": "A URL for a small icon beside the footer text." }, "ts": { "type": "integer", "description": "A Unix timestamp to display alongside the footer." }, "mrkdwn_in": { "type": "array", "description": "An array of field names that should be formatted as mrkdwn.", "items": { "type": "string", "enum": [ "text", "pretext", "fields" ] } }, "actions": { "type": "array", "description": "An array of interactive message actions (legacy; prefer Block Kit).", "items": { "type": "object" } }, "callback_id": { "type": "string", "description": "An identifier for the set of actions in this attachment." }, "blocks": { "type": "array", "description": "Block Kit blocks within the attachment.", "items": { "type": "object" } } } } }, "files": { "type": "array", "description": "An array of file objects attached to or shared in the message.", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "The unique file identifier." }, "name": { "type": "string", "description": "The filename." }, "title": { "type": "string", "description": "The title of the file." }, "mimetype": { "type": "string", "description": "The MIME type of the file." }, "filetype": { "type": "string", "description": "The Slack file type identifier." }, "size": { "type": "integer", "description": "File size in bytes." }, "url_private": { "type": "string", "format": "uri", "description": "Authenticated URL to access the file." }, "permalink": { "type": "string", "format": "uri", "description": "Permalink URL for the file." }, "mode": { "type": "string", "description": "The file mode (hosted, external, snippet, post).", "enum": [ "hosted", "external", "snippet", "post", "space", "quip" ] } } } }, "reactions": { "type": "array", "description": "An array of emoji reactions applied to this message. Only present when reactions exist.", "items": { "type": "object", "required": [ "name", "count", "users" ], "properties": { "name": { "type": "string", "description": "The emoji name without surrounding colons (e.g., 'thumbsup', 'heart', 'eyes')." }, "count": { "type": "integer", "description": "The number of users who have applied this reaction.", "minimum": 1 }, "users": { "type": "array", "description": "An array of user IDs who applied this reaction.", "items": { "type": "string", "pattern": "^[UW][A-Z0-9]+$" } } } } }, "edited": { "type": "object", "description": "Metadata about when and by whom the message was last edited. Only present on edited messages.", "properties": { "user": { "type": "string", "description": "The user ID of the person who edited the message.", "pattern": "^[UW][A-Z0-9]+$" }, "ts": { "type": "string", "description": "The timestamp of the edit.", "pattern": "^[0-9]+\\.[0-9]+$" } }, "required": [ "user", "ts" ] }, "bot_id": { "type": "string", "description": "The bot ID if this message was posted by a bot. Bot IDs begin with B.", "pattern": "^B[A-Z0-9]+$" }, "bot_profile": { "type": "object", "description": "Information about the bot that posted this message.", "properties": { "id": { "type": "string" }, "deleted": { "type": "boolean" }, "name": { "type": "string" }, "updated": { "type": "integer" }, "app_id": { "type": "string" }, "icons": { "type": "object", "properties": { "image_36": { "type": "string", "format": "uri" }, "image_48": { "type": "string", "format": "uri" }, "image_72": { "type": "string", "format": "uri" } } }, "team_id": { "type": "string" } } }, "app_id": { "type": "string", "description": "The app ID if this message was posted by an app." }, "metadata": { "type": "object", "description": "Custom metadata attached to the message by an application. Metadata allows apps to attach structured data to messages for use in workflows and automations without affecting the visible message content.", "properties": { "event_type": { "type": "string", "description": "A human-readable identifier for the metadata event type." }, "event_payload": { "type": "object", "description": "A free-form JSON object containing the metadata payload." } }, "required": [ "event_type", "event_payload" ] }, "permalink": { "type": "string", "format": "uri", "description": "A permanent URL pointing to this specific message within Slack." }, "client_msg_id": { "type": "string", "description": "A unique identifier assigned by the client when the message was sent. Used for deduplication.", "format": "uuid" }, "team": { "type": "string", "description": "The team (workspace) ID where this message was posted.", "pattern": "^T[A-Z0-9]+$" }, "parent_user_id": { "type": "string", "description": "The user ID of the parent message author, if this is a threaded reply.", "pattern": "^[UW][A-Z0-9]+$" }, "is_starred": { "type": "boolean", "description": "Whether the authenticated user has starred this message." }, "pinned_to": { "type": "array", "description": "An array of channel IDs where this message is pinned.", "items": { "type": "string", "pattern": "^[CG][A-Z0-9]+$" } }, "upload": { "type": "boolean", "description": "Whether the message is a file upload notification." }, "display_as_bot": { "type": "boolean", "description": "Whether the message should be displayed as if from a bot." } } }