HTTP 400 (Bad Request)

I am trying to make a system where a user inputs some text in a textbox and it gets sent to a webhook. I’ve managed to transfer the text to the server and I’ve tested this by printing from a server script which works.

However, when I try to send it to a Discord webhook (through the proxy WebhookProxy | Discord webhooks go brrrrrrr and I’ve also tried Discord Webhook Proxy), I just get an HTTP 400 (BAD REQUEST) error message.

Here is my code for the server script:

game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player, msg)
	local HTTPS = game:GetService("HttpService")
	local WebhookURL = "https://hooks.hyra.io/api/webhooks/id/token/"
	
	local WebhookMessage = HTTPS:JSONEncode(msg)
	HTTPS:PostAsync(WebhookURL, WebhookMessage)
end)

Discord Webhooks need a “content” parameter, which is the message.

for example:

local WebhookMessage = {
    ["content"] = msg
}
1 Like

Did you turned on http in the game settings?

This has not worked. Same error.

Yes.
char char char char char char

did you turn it into a JSON using :JSONEncode ?

Nope. That’s fixed it, thanks so much.