Discord Webhooks not Working

I don’t know why but all of a sudden literally all my scripts that have been working for over 6 months using discord webhooks have stopped working. Can someone tell me why this doesn’t work? The error was (HTTP 400 BAD REQUEST).

local ErrorWebhookData = {
    ["embed"] = {
        ["title"] = "TEST",
    }
}
local ErrorWebhookDataReady = HttpService:JSONEncode(ErrorWebhookData)
HttpService:PostAsync(WebhookURL,ErrorWebhookDataReady)

Do you have HTTP request turned on in settings?

Did the webhook link change?

1 Like

Hey TheSingularFungi, yes I have HTTP requests enabled and I just created a new webhook to test and it still does not work.

Hello!

Your topic is pretty similar to one I was able to find, right here.

This issue for another developer who had the same problem was the way he formatted his embed. Also make sure you have HTTP requests enabled in your games settings, and that you have the correct webhook URL.

1 Like

Hey DyIan_II, thanks for the tip. After a bit of trial and error i realized that when i add content to the the data it posts the content but not the embed. To clarify, the webhook is fine, but i’m not sure what is wrong with my current formatting for the embed. If you could help me out that’d be great!

Modified Code

local webToSend = {
	content = "hi",
	embed = {
		title = "test",
		description = "test2"
	}
}

HttpService:PostAsync(WebhookURL,HttpService:JSONEncode(webToSend))

Here’s a good example of a well-formatted discord embed:

local data = 
	{
		["content"] = "",
		["embeds"] = {{
			["title"] = "__**Ultimate Title**__",
			["description"] = "blah blah",
			["type"] = "rich",
			["color"] = tonumber(0xffffff),
			["fields"] = {
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				},
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				}
			}
		}}
	}

Note that you don’t need to use fields if you don’t want them, and if you only want to roll with the title and description, that’ll work totally fine.

1 Like

Sheesh thanks man! Funny really! All I had to do was add an extra curly brace in front of data before declaring my embed variables. Much love! Tested it out and it is working c;

1 Like

I believe messages sent by webhooks don’t have an “embed” field, but rather “embeds”, because webhook messages allow for multiple embeds in one message (since nobody actually answered your question as to why it’s not working)

1 Like