You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/change-log/2025-04-22-components-v2.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,9 @@ We're bringing new components to messages that you can use in your apps. They al
13
13
14
14
Our previous components system, while functional, had limitations:
15
15
16
-
- Content, attachments, embeds, and components had to follow fixed positioning rules
16
+
- Content, attachments, embeds, and components had to follow fixed vertical positioning rules
17
17
- Visual styling options were limited
18
+
- It was difficult to make visually cohesive experiences that combined the various functionalities of messages given they were expressed in a non-unified system
18
19
19
20
Our new component system addresses these challenges with fully composable components that can be arranged and laid out in any order, allowing for a more flexible and visually appealing design.
20
21
@@ -32,7 +33,7 @@ Our new component system addresses these challenges with fully composable compon
32
33
33
34
-[**Text Display**](/docs/components/reference#text-display) - Add rich markdown-formatted text anywhere in your messages
34
35
-[**Thumbnail**](/docs/components/reference#thumbnail) - An image used in a [section](/docs/components/reference#section)
35
-
-[**Media Gallery**](/docs/components/reference#media-gallery) - Present collections of images in an organized grid
36
+
-[**Media Gallery**](/docs/components/reference#media-gallery) - Present collections of images and videos in an organized grid
36
37
-[**File**](/docs/components/reference#file) - Embed file attachments as part of your message layout
37
38
38
39
#### Getting Started
@@ -49,7 +50,7 @@ We've created guides to help you implement these new features:
49
50
[Legacy component behavior](/docs/components/reference#legacy-message-component-behavior) will continue to work as before, so your existing integrations won't break. However, when using the Components V2 flag, you'll need to adapt to a few changes:
50
51
51
52
- The `content` and `embeds` fields will no longer work but you'll be able to use [Text Display](/docs/components/reference#text-display) and [Container](/docs/components/reference#container) as replacements
52
-
- Attachments need to be exposed through components to be visible
53
+
- Attachments need to be exposed through components to be visible. You can use a [Media Gallery](/docs/components/reference#media-gallery), [Thumbnail](/docs/components/reference#thumbnail), or [File](/docs/components/reference#file) component to display them
53
54
- The `poll` and `stickers` fields are disabled
54
55
- A max of 10 top-level components and 30 total components in a message
@@ -892,14 +893,14 @@ To use this component, you need to send the [message flag](/docs/resources/messa
892
893
| type | integer |`10` for text display |
893
894
| id? | integer | Optional identifier for component |
894
895
| content | string | Text that will be displayed similar to a message |
895
-
896
+
Th
896
897
###### Example
897
898
898
899
```json
899
900
"components": [
900
901
{
901
902
"type": 10,
902
-
"content": "# This is a Text Display\nAll the regular markdown rules apply\n- You can make lists\n- You can use `code blocks`\n- You can use [links](https://discord.com/)\n- Even :blush: :star_struck: :exploding_head:\n- Spolier alert: ||these too!||"
903
+
"content": "# This is a Text Display\nAll the regular markdown rules apply\n- You can make lists\n- You can use `code blocks`\n- You can use [links](http://watchanimeattheoffice.com/)\n- Even :blush: :star_struck: :exploding_head:\n- Spolier alert: ||these too!||"
903
904
}
904
905
]
905
906
```
@@ -968,16 +969,16 @@ To use this component, you need to send the [message flag](/docs/resources/messa
"description": "An aerial view looking down on older industrial complex buildings. The main building is white with many windows and pipes running up the walls."
"description": "An aerial view of old broken buildings. Nature has begun to take root in the rooftops. A portion of the middle building's roof has collapsed inward. In the distant haze you can make out a far away city."
"description": "A street view of a downtown city. Prominently in photo are skyscrapers and a domed building"
981
982
}
982
983
]
983
984
}
@@ -988,7 +989,7 @@ To use this component, you need to send the [message flag](/docs/resources/messa
988
989
989
990
## File
990
991
991
-
A File is a top-level component that allows you to display an uploaded file as an attachment to the message and reference it in the component. This is similar to the `embeds` field of a message but allows you to control the layout of your message by using this anywhere as a component. Files are only available in messages.
992
+
A File is a top-level component that allows you to display an [uploaded file](/docs/components/reference#uploading-a-file) as an attachment to the message and reference it in the component. Each file component can only display 1 attached file, but you can upload multiple files and add them to different file components within your payload. This is similar to the `embeds` field of a message but allows you to control the layout of your message by using this anywhere as a component. Files are only available in messages.
992
993
993
994
:::info
994
995
To use this component, you need to send the [message flag](/docs/resources/message#message-object-message-flags)`1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis.
@@ -1061,16 +1062,16 @@ To use this component, you need to send the [message flag](/docs/resources/messa
1061
1062
"components": [
1062
1063
{
1063
1064
"type": 10,
1064
-
"content": "Above"
1065
+
"content": "It's dangerous to go alone!"
1065
1066
},
1066
1067
{
1067
1068
"type": 14,
1068
1069
"divider": true,
1069
-
"spacing": 2
1070
+
"spacing": 1
1070
1071
},
1071
1072
{
1072
1073
"type": 10,
1073
-
"content": "Below"
1074
+
"content": "Take this."
1074
1075
}
1075
1076
]
1076
1077
```
@@ -1113,7 +1114,7 @@ To use this component, you need to send the [message flag](/docs/resources/messa
| proxy_url? | string | The proxied url of the media item. This field is ignored and provided by the API as part of the response |
1160
1161
| height? | ?integer | The height of the media item. This field is ignored and provided by the API as part of the response |
1161
1162
| width? | ?integer | The width of the media item. This field is ignored and provided by the API as part of the response |
1162
1163
| content_type? | string | The [media type](https://en.wikipedia.org/wiki/Media_type) of the content. This field is ignored and provided by the API as part of the response |
1163
1164
1164
1165
### Uploading a file
1165
1166
1166
-
You can upload a file when sending a message and reference it within a file component using the `attachment://<filename>` syntax. Each file component can only display 1 attached file, but you can upload multiple files and add them to different file components within your payload.
1167
-
1168
1167
To upload a file with your message, you'll need to send your payload as `multipart/form-data` (rather than `application/json`) and include your file with a valid filename in your payload. Details and examples for uploading files can be found in the [API Reference](/docs/reference#uploading-files).
1169
1168
1170
1169
## Legacy Message Component Behavior
1171
1170
1172
-
Before the introduction of the `IS_COMPONENTS_V2` flag ([see changelog](/docs/change-log/2025-04-22-components-v2)), message components were sent as part of the message content. This means that you could send a message with components without setting the `IS_COMPONENTS_V2` flag, and the components would be included in the message content along with `content` and `embeds`.
1171
+
Before the introduction of the `IS_COMPONENTS_V2` flag ([see changelog](/docs/change-log/2025-04-22-components-v2)), message components were sent in conjunction with message content. This means that you could send a message using a subset of the available components without setting the `IS_COMPONENTS_V2` flag, and the components would be included in the message content along with `content` and `embeds`.
1173
1172
1174
1173
Apps using this Legacy Message Component behavior will continue to work as expected, but it is recommended to use the new `IS_COMPONENTS_V2` flag for new apps or features as they offer more options for layout and customization.
Copy file name to clipboardExpand all lines: docs/components/using-message-components.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ If you are sending components as part of a [webhook](/docs/resources/webhook) yo
22
22
23
23
## Sending a Message with a Component
24
24
25
-
To send a message with a component, you need to set the `IS_COMPONENTS_V2` flag (`1<<15`) in your message's `flags` field. This can be done when using [Message Create](/docs/resources/message#create-message), [Execute Webhook](/docs/resources/webhook#execute-webhook), or responding to an interaction.
25
+
To send a message with a component, you need to set the `IS_COMPONENTS_V2` flag (`1<<15`) in your message's `flags` field. This can be done when using [Message Create](/docs/resources/message#create-message), [Execute Webhook](/docs/resources/webhook#execute-webhook), or [responding to an interaction](/docs/interactions/receiving-and-responding#create-followup-message).
26
26
27
27
This flag indicates that the message contains components and disables traditional content and embeds.
0 commit comments