Overview
Message components are a powerful way to add interactivity to your messages. They allow you to create rich, interactive experiences for your users, making it easier for them to engage with your content.If you are sending components as part of a webhook you’ll need to use the
?with_components=true query param otherwise they’ll be ignored.Prerequisites
- You must have a Discord account and be a member of the Discord Developer Portal.
- You must have a Discord application created in the Discord Developer Portal.
- You must have the necessary permissions to send messages in the channel where you want to use components.
Sending a Message with a Component
To send a message with a component, you need to set theIS_COMPONENTS_V2 flag (1<<15) in your message’s flags field. This can be done when using Message Create, Execute Webhook, or responding to an interaction.
This flag indicates that the message contains components and disables traditional content and embeds.
All content must be sent as components instead of using the standard message format.
Sending a Message with Multiple Components
To send a message with multiple components, you can include multiple component objects in your message’scomponents field. This field allows you to specify an array of components that will be included in the message.