HTTP 400 (Bad Request)

With this script…

local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")

local Webhook = "link"

local Timeout = 5
local CanUse = true
local Remote = script.Parent.Text

Remote.OnServerEvent:Connect(function(Player,Text)
	if not CanUse then return end
	if Text == "" then return end
	CanUse = false
	local PlayerImage = Players:GetUserThumbnailAsync(Player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
	print(PlayerImage)
	local Date = string.format("%s:%s, %s, %s",os.date("%H"),os.date("%M"),os.date("%d"),os.date("%B"))
	print(Date)
	local Data = {
		["content"] = string.format('Reported "%s", at %s.',Text,Date),
		["username"] = Player.Name,
		["avatar_url"] = PlayerImage,
	}
	Data = HttpService:JSONEncode(Data)
	HttpService:PostAsync(Webhook,Data) -- line 24
	task.wait(Timeout)
	CanUse = true
end)

…I manage to send some reports to a chat I have on my Discord server. However, I get the HTTP 400 (Bad Request) error at line 24. What am I doing wrong?

are you using a discord webhook?

Of course. With the deprecated version. And even if it was the blocked URL, Studio should still work. Plus, the error for this is “Forbidden”. My problem is “Bad Request”.

1 Like

Bad Request still could mean it got blocked by the receiving server, it’s likely that discord rolled out a block for roblox studio too.

Either way it’s better to use a proxy server.

Can you recommend one?

You can create your own.

However for simplicity use this one, it’s trusted.
WebhookProxy (lewistehminerz.dev)

1 Like

This could help, using discord isn’t a good thing either way since it blocked roblox . I know this isn’t your error but it could still help.

Using the provided information I still get the same error.

Unfortunately it is true because discord blocked roblox because users abused webhooks

I would prefer not to use Guilded. Mulțumesc

Summarry

I’d actually think it’s the EncodedData variable. I doubt that I wrote it correctly, but what is misspelled?

Ehh fixed that by changing a variable.

Actually, the “content” field is the only one to be correct. How about the other 2?

EDIT: avatar_url doesn’t work.

Oh, alright. Have a good day and good luck with your error then !:romania:

1 Like

Ah yes. I believe the URL formatting of Roblox’s sucks. Anyway, I managed to turn that URL into a PNG one.