Description
Trying to send a webhook using the new WebhookClient API results in error 50006 'Cannot send an empty message'.
Steps to Reproduce
The following code snippet (with redactions) creates the error in my enviroment.
const { WebhookClient, MessageFlags, TextDisplayBuilder } = require('discord.js');
const templatesWebhook = new WebhookClient ({ url: 'https://discord.com/api/v10/webhooks/_redacted_/_redacted_?with_components=true'});
const textComponent = new TextDisplayBuilder().setContent( 'test message webhook');
await templatesWebhook.send({flags: MessageFlags.IsComponentsV2, components: [textComponent]});
Expected Behavior
The webhook should be sent and complete.
Current Behavior
Results in the following error (pay attention to the query at the end of the reported URL).
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/webhooks/__redacted__/__redacted__?wait=true'
Screenshots/Videos
not relevant in this instance.
Client and System Information
discord.js v14.19.3
node v v22.16.0
VSC v1.100.3
win 10 pro x64 22H2 build 19045.5854
Description
Trying to send a webhook using the
new WebhookClientAPI results in error 50006 'Cannot send an empty message'.Steps to Reproduce
The following code snippet (with redactions) creates the error in my enviroment.
const { WebhookClient, MessageFlags, TextDisplayBuilder } = require('discord.js');
const templatesWebhook = new WebhookClient ({ url: 'https://discord.com/api/v10/webhooks/_redacted_/_redacted_?with_components=true'});
const textComponent = new TextDisplayBuilder().setContent( 'test message webhook');
await templatesWebhook.send({flags: MessageFlags.IsComponentsV2, components: [textComponent]});
Expected Behavior
The webhook should be sent and complete.
Current Behavior
Results in the following error (pay attention to the query at the end of the reported URL).
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/webhooks/__redacted__/__redacted__?wait=true'
Screenshots/Videos
not relevant in this instance.
Client and System Information
discord.js v14.19.3
node v v22.16.0
VSC v1.100.3
win 10 pro x64 22H2 build 19045.5854