Message object
Fields specific to the
MESSAGE_CREATE and MESSAGE_UPDATE events are listed in the Gateway documentation.Message structure
ID of the message
ID of the channel the message was sent in
The author of this message. Not guaranteed to be a valid user — if the message is generated by a webhook, the author object corresponds to the webhook’s id, username, and avatar.
Contents of the message
When this message was sent
When this message was edited (or null if never)
Whether this was a TTS message
Whether this message mentions everyone
Users specifically mentioned in the message
Roles specifically mentioned in this message
Channels specifically mentioned in this message. Only textual channels visible to everyone in a public guild will ever be included. Only crossposted messages currently include
mention_channels.Any attached files
Any embedded content
Reactions to the message
Used for validating a message was sent
Whether this message is pinned
If the message is generated by a webhook, this is the webhook’s id
Sent with Rich Presence-related chat embeds
Sent with Rich Presence-related chat embeds
If the message is an interaction or application-owned webhook, this is the id of the application
Message flags combined as a bitfield
Data showing the source of a crosspost, channel follow add, pin, or reply message
The message associated with the
message_reference. A minimal subset of fields in a message (e.g. author is excluded).The message associated with the message_reference. Only returned for messages with a type of
REPLY (19), THREAD_STARTER_MESSAGE (21), or CONTEXT_MENU_COMMAND (23).Sent if the message is sent as a result of an interaction
The thread that was started from this message, includes thread member object
Sent if the message contains components like buttons, action rows, or other interactive components
Sent if the message contains stickers
A generally increasing integer that represents the approximate position of the message in a thread
Data of the role subscription purchase or renewal that prompted this
ROLE_SUBSCRIPTION_PURCHASE messageA poll
The call associated with the message
Example message
Message types
| Type | Value | Deletable |
|---|---|---|
DEFAULT | 0 | true |
RECIPIENT_ADD | 1 | false |
RECIPIENT_REMOVE | 2 | false |
CALL | 3 | false |
CHANNEL_NAME_CHANGE | 4 | false |
CHANNEL_ICON_CHANGE | 5 | false |
CHANNEL_PINNED_MESSAGE | 6 | true |
USER_JOIN | 7 | true |
GUILD_BOOST | 8 | true |
GUILD_BOOST_TIER_1 | 9 | true |
GUILD_BOOST_TIER_2 | 10 | true |
GUILD_BOOST_TIER_3 | 11 | true |
CHANNEL_FOLLOW_ADD | 12 | true |
GUILD_DISCOVERY_DISQUALIFIED | 14 | true |
GUILD_DISCOVERY_REQUALIFIED | 15 | true |
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING | 16 | true |
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING | 17 | true |
THREAD_CREATED | 18 | true |
REPLY | 19 | true |
CHAT_INPUT_COMMAND | 20 | true |
THREAD_STARTER_MESSAGE | 21 | false |
GUILD_INVITE_REMINDER | 22 | true |
CONTEXT_MENU_COMMAND | 23 | true |
AUTO_MODERATION_ACTION | 24 | true* |
ROLE_SUBSCRIPTION_PURCHASE | 25 | true |
STAGE_START | 27 | true |
STAGE_END | 28 | true |
STAGE_SPEAKER | 29 | true |
STAGE_TOPIC | 31 | true |
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION | 32 | true |
POLL_RESULT | 46 | true |
MANAGE_MESSAGES permission.
Message flags
| Flag | Value | Description |
|---|---|---|
CROSSPOSTED | 1 << 0 | This message has been published to subscribed channels (via Channel Following) |
IS_CROSSPOST | 1 << 1 | This message originated from a message in another channel (via Channel Following) |
SUPPRESS_EMBEDS | 1 << 2 | Do not include any embeds when serializing this message |
SOURCE_MESSAGE_DELETED | 1 << 3 | The source message for this crosspost has been deleted (via Channel Following) |
URGENT | 1 << 4 | This message came from the urgent message system |
HAS_THREAD | 1 << 5 | This message has an associated thread, with the same id as the message |
EPHEMERAL | 1 << 6 | This message is only visible to the user who invoked the Interaction |
LOADING | 1 << 7 | This message is an Interaction Response and the bot is “thinking” |
FAILED_TO_MENTION_SOME_ROLES_IN_THREAD | 1 << 8 | This message failed to mention some roles and add their members to the thread |
SUPPRESS_NOTIFICATIONS | 1 << 12 | This message will not trigger push and desktop notifications |
IS_VOICE_MESSAGE | 1 << 13 | This message is a voice message |
HAS_SNAPSHOT | 1 << 14 | This message has a snapshot (via Message Forwarding) |
IS_COMPONENTS_V2 | 1 << 15 | Allows you to create fully component-driven messages. Once set, cannot be removed. |
Message reference object
Message reference structure
Type of reference. Defaults to
DEFAULT if unset.ID of the originating message
ID of the originating message’s channel. Optional when creating a reply; required for forwards.
ID of the originating message’s guild
When sending, whether to error if the referenced message doesn’t exist instead of sending as a normal message. Default
true.Message reference types
| Type | Value | Coupled message field | Description |
|---|---|---|---|
DEFAULT | 0 | referenced_message | A standard reference used by replies |
FORWARD | 1 | message_snapshot | Reference used to point to a message at a point in time |
Embed object
Embed structure
Title of embed
Type of embed (always “rich” for webhook embeds)
Description of embed
URL of embed
Timestamp of embed content
Color code of the embed
Footer information
Image information
Thumbnail information
Video information
Provider information
Author information
Fields information, max of 25
Embed types
| Type | Description |
|---|---|
rich | Generic embed rendered from embed attributes |
image | Image embed |
video | Video embed |
gifv | Animated gif image embed rendered as a video embed |
article | Article embed |
link | Link embed |
poll_result | Poll result embed |
Embed limits
| Field | Limit |
|---|---|
title | 256 characters |
description | 4096 characters |
fields | Up to 25 field objects |
field.name | 256 characters |
field.value | 1024 characters |
footer.text | 2048 characters |
author.name | 256 characters |
title, description, field.name, field.value, footer.text, and author.name fields across all embeds must not exceed 6000 characters.
Attachment object
Attachment structure
Attachment id
Name of file attached
The title of the file
Description for the file (max 1024 characters)
The attachment’s media type
Size of file in bytes
Source URL of file
A proxied URL of file
Height of file (if image)
Width of file (if image)
Whether this attachment is ephemeral. Ephemeral attachments will automatically be removed after a set period of time.
The duration of the audio file (currently for voice messages)
Base64 encoded bytearray representing a sampled waveform (currently for voice messages)
Attachment flags combined as a bitfield
Attachment flags
| Flag | Value | Description |
|---|---|---|
IS_REMIX | 1 << 2 | This attachment has been edited using the remix feature on mobile |
Reaction object
Reaction structure
Total number of times this emoji has been used to react (including super reacts)
Reaction count details object
Whether the current user reacted using this emoji
Whether the current user super-reacted using this emoji
Emoji information
HEX colors used for super reaction
Allowed mentions object
Theallowed_mentions field lets you determine whether users will receive notifications when you include mentions in the message content.
Allowed mention types
| Type | Value | Description |
|---|---|---|
| Role Mentions | "roles" | Controls role mentions |
| User Mentions | "users" | Controls user mentions |
| Everyone Mentions | "everyone" | Controls @everyone and @here mentions |
Allowed mentions structure
An array of allowed mention types to parse from the content
Array of role ids to mention, max 100
Array of user ids to mention, max 100
For replies, whether to mention the author of the message being replied to, defaults to false
The
parse field is mutually exclusive with the roles and users fields. You cannot use both parse: ["users"] and users: [...] in the same request.Get channel messages
GET
/channels/{channel.id}/messagesThe
before, after, and around parameters are mutually exclusive, only one may be passed at a time.Query string params
Get messages around this message ID
Get messages before this message ID
Get messages after this message ID
Max number of messages to return (1-100)
Get channel message
GET
/channels/{channel.id}/messages/{message.id}Create message
POST
/channels/{channel.id}/messagesMessage Create Gateway event.
Limitations
- When operating on a guild channel, the current user must have the
SEND_MESSAGESpermission. - When sending a message with
ttsset totrue, the current user must have theSEND_TTS_MESSAGESpermission. - The maximum request size when sending a message is 25 MiB.
JSON/form params
Message contents (up to 2000 characters). At least one of
content, embeds, sticker_ids, components, files[n], poll, or shared_client_theme is required.Can be used to verify a message was sent (up to 25 characters)
true if this is a TTS messageUp to 10
rich embeds (up to 6000 characters)Allowed mentions for the message
Include to make your message a reply or a forward
Components to include with the message
IDs of up to 3 stickers in the server to send in the message
Attachment objects with filename and description
Message flags; only
SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, IS_VOICE_MESSAGE, and IS_COMPONENTS_V2 can be setIf true and nonce is present, it will be checked for uniqueness in the past few minutes
A poll
Example request body
Crosspost message
POST
/channels/{channel.id}/messages/{message.id}/crosspostSEND_MESSAGES permission if the current user sent the message, or MANAGE_MESSAGES for all other messages.
Create reaction
PUT
/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@meREAD_MESSAGE_HISTORY permission. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires ADD_REACTIONS permission. Returns a 204 empty response on success.
The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, encode it in the format name:id.
Delete own reaction
DELETE
/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@meDelete user reaction
DELETE
/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}MANAGE_MESSAGES permission.
Search guild messages
GET
/guilds/{guild.id}/messages/searchREAD_MESSAGE_HISTORY permission.
Query string params
Filter messages by content (max 1024 characters)
Filter messages by these channels (max 500)
Filter messages by these authors (max 100)
Filter messages that mention these users (max 100)
Filter messages by whether they are or are not pinned
Filter messages by whether or not they have specific things (
image, sound, video, file, sticker, embed, link, poll, snapshot)The sorting algorithm to use:
timestamp (default) or relevanceThe direction to sort:
asc or descMax number of messages to return (1-25)
Number to offset the returned messages by (max 9975)