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)
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.
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))
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;
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)