So, I wanted a discord webhook to send a message. The problem is, It says HttpError: 400 Bad requests. So, I realize there is a mistake I made in JSON. So, I fix it. But, it still didn’t work. Still says 400.
Here is my code
local image = game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
local data = {
["embeds"] = {
["author"] = {
["name"] = player.DisplayName.." (@"..player.Name..")",
["icon_url"] = image,
},
["description"] = content,
["footer"] = {
["text"] = "Posted by UserId: "..player.UserId
},
}
}
local finalData = HttpService:JSONEncode(data)
HttpService:PostAsync(webhook, finalData)
HttpError: 400 Bad requests means you’re using incorrect formatting or have missing information/data, check documentation of the api you’re trying to use, here’s the one for discord:
local image = game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
local data = {
["embeds"] = {{ -- keep in mind you can post multiple embeds
["author"] = {
["name"] = player.DisplayName.." (@"..player.Name..")",
-- no, it does not return an url ["icon_url"] = image,
},
["description"] = content,
["footer"] = {
["text"] = "Posted by UserId: "..player.UserId
},
}}
}
local finalData = HttpService:JSONEncode(data)
HttpService:PostAsync(webhook, finalData)