Skip to content

Commit fbbbbf3

Browse files
authored
docs: update execute webhook and edit webhook message section
Updated both desction with the new components v2 behaviour.
1 parent 8549d83 commit fbbbbf3

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

docs/resources/webhook.mdx

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -220,27 +220,29 @@ Discord may strip certain characters from message content, like invalid unicode
220220

221221
###### JSON/Form Params
222222

223-
| Field | Type | Description | Required |
224-
|-------------------|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
225-
| content | string | the message contents (up to 2000 characters) | one of content, file, embeds, poll |
226-
| username | string | override the default username of the webhook | false |
227-
| avatar_url | string | override the default avatar of the webhook | false |
228-
| tts | boolean | true if this is a TTS message | false |
229-
| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content | one of content, file, embeds, poll |
230-
| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | false |
231-
| components \* | array of [message component](/docs/components/reference#component-object) | the components to include with the message | false |
232-
| files[n] \*\* | file contents | the contents of the file being sent | one of content, file, embeds, poll |
233-
| payload_json \*\* | string | JSON encoded body of non-file params | `multipart/form-data` only |
234-
| attachments \*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attachment objects with filename and description | false |
235-
| flags | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS` and `SUPPRESS_NOTIFICATIONS` can be set) | false |
236-
| thread_name | string | name of thread to create (requires the webhook channel to be a forum or media channel) | false |
237-
| applied_tags | array of snowflakes | array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) | false |
238-
| poll | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! | one of content, file, embeds, poll |
223+
| Field | Type | Description | Required |
224+
|-------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
225+
| content | string | the message contents (up to 2000 characters) | one of content, file, embeds, poll |
226+
| username | string | override the default username of the webhook | false |
227+
| avatar_url | string | override the default avatar of the webhook | false |
228+
| tts | boolean | true if this is a TTS message | false |
229+
| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content | one of content, file, embeds, poll |
230+
| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | false |
231+
| components \* | array of [message component](/docs/components/reference#component-object) | the components to include with the message | false |
232+
| files[n] \*\* | file contents | the contents of the file being sent | one of content, file, embeds, poll |
233+
| payload_json \*\* | string | JSON encoded body of non-file params | `multipart/form-data` only |
234+
| attachments \*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attachment objects with filename and description | false |
235+
| flags \*\*\* | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS` and `IS_COMPONENTS_V2` can be set) | false |
236+
| thread_name | string | name of thread to create (requires the webhook channel to be a forum or media channel) | false |
237+
| applied_tags | array of snowflakes | array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) | false |
238+
| poll | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! | one of content, file, embeds, poll |
239239

240240
\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param.
241241

242242
\*\* See [Uploading Files](/docs/reference#uploading-files) for details.
243243

244+
\*\*\* When the flag `IS_COMPONENTS_V2` is set, the webhook message can only contain `components`. Providing `content, `embeds`, `files[n]` or `poll` will fail with a 400 BAD REQUEST response.
245+
244246
:::info
245247
For the webhook embed objects, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images.
246248
:::
@@ -285,7 +287,7 @@ Returns a previously-sent webhook message from the same token. Returns a [messag
285287

286288
Edits a previously-sent webhook message from the same token. Returns a [message](/docs/resources/message#message-object) object on success.
287289

288-
When the `content` field is edited, the `mentions` array in the message object will be reconstructed from scratch based on the new content. The `allowed_mentions` field of the edit request controls how this happens. If there is no explicit `allowed_mentions` in the edit request, the content will be parsed with _default_ allowances, that is, without regard to whether or not an `allowed_mentions` was present in the request that originally created the message.
290+
When the `content` field is edited, the arrays `mentions` and `mention_roles` and the boolean `mention_everyone` in the message object will be reconstructed from scratch based on the new content. When the message flag `IS_COMPONENTS_V2` is set, the reconstructed arrays and boolean are based on the edited content in the `components` array. The `allowed_mentions` field of the edit request controls how this happens. If there is no explicit `allowed_mentions` in the edit request, the content will be parsed with _default_ allowances, that is, without regard to whether or not an `allowed_mentions` was present in the request that originally created the message.
289291

290292
Refer to [Uploading Files](/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests.
291293
Any provided files will be **appended** to the message. To remove or replace files you will have to supply the `attachments` field which specifies the files to retain on the message after edit.
@@ -307,22 +309,25 @@ All parameters to this endpoint are optional and nullable.
307309

308310
###### JSON/Form Params
309311

310-
| Field | Type | Description |
311-
|-------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------|
312-
| content | string | the message contents (up to 2000 characters) |
313-
| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content |
314-
| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message |
315-
| components \* | array of [message component](/docs/components/reference#component-object) | the components to include with the message |
316-
| files[n] \*\* | file contents | the contents of the file being sent/edited |
317-
| payload_json \*\* | string | JSON encoded body of non-file params (multipart/form-data only) |
318-
| attachments \*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attached files to keep and possible descriptions for new files |
319-
| poll \*\*\* | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! |
312+
| Field | Type | Description |
313+
|---------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
314+
| content | string | the message contents (up to 2000 characters) |
315+
| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content |
316+
| flags \* | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (`SUPPRESS_EMBEDS` and `IS_COMPONENTS_V2` only) |
317+
| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message |
318+
| components \*\* | array of [message component](/docs/components/reference#component-object) | the components to include with the message |
319+
| files[n] \*\*\* | file contents | the contents of the file being sent/edited |
320+
| payload_json \*\*\* | string | JSON encoded body of non-file params (multipart/form-data only) |
321+
| attachments \*\*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attached files to keep and possible descriptions for new files |
322+
| poll \*\*\*\* | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! |
320323

321-
\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param.
324+
\* The `SUPPRESS_EMBEDS` flag can be both set and unset, while the `IS_COMPONENTS_V2` flag can only be set. When the `IS_COMPONENTS_V2` flag is set, any of the used `content`, `embeds`, `files[n]` or `poll` values in the initial message must be set to `null` first, otherwise it will fail with a 400 BAD REQUEST response.
322325

323-
\*\* See [Uploading Files](/docs/reference#uploading-files) for details.
326+
\*\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param.
327+
328+
\*\*\* See [Uploading Files](/docs/reference#uploading-files) for details.
324329

325-
\*\*\* Polls can only be added when editing a deferred interaction response.
330+
\*\*\*\* Polls can only be added when editing a deferred interaction response.
326331

327332
## Delete Webhook Message
328333
<Route method="DELETE">/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/docs/resources/message#message-object)</Route>

0 commit comments

Comments
 (0)