[httpService] Issues with discord webhooks

i have a issue where it gives the error, HTTP 400 (Bad Request)

here is the script:

game.ReplicatedStorage.MessageN.OnServerEvent:Connect(function(plr, mess)
    wait()
    print(plr.Name.." sended the message "..mess)
    plr:WaitForChild("leaderstats"):WaitForChild("Messages Send").Value = plr:WaitForChild("leaderstats"):WaitForChild("Messages Send").Value + 1
    local userId = plr.UserId
    local thumbType = Enum.ThumbnailType.HeadShot
    local thumbSize = Enum.ThumbnailSize.Size420x420
    local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
    
    local DataN = 
        {
            ["content"] = "",
            ["embeds"] = {{
                ["title"] = "You got a message",
                ["description"] = "You can send your own message on [this game](https://www.roblox.com/games/6491474235/Chatbot)",
                ["type"] = "rich",
                ["color"] = tonumber(3447003),
                ["author"] = {
                    ["name"] = plr.Name,
                    ["url"] = "https://www.roblox.com/users/"..plr.UserId.."/profile",
                    ["icon_url"] = content,
                },
                ["footer"] = {
                    ["text"] = os.date("this message was send on %A %m %B %X %Y",os.time())
                },
                ["fields"] = {
                    {
                        ["name"] = ":speech_balloon:",
                        ["value"] = mess,
                    },
                }
            }}
        }
    
local DataNN = http:JSONEncode(DataN)
    http:PostAsync(webhookN, DataNN)
end)

the error is for this line:

http:PostAsync(webhookN, DataNN)
1 Like

This error usually means that you formatted your DataN variable incorrectly

1 Like

I thought Discord blocked Studio’s user agent?