trying to make a discord feedback

local chat = game:GetService("Chat")
local http = game:GetService("HttpService")
local event = game.ReplicatedStorage.Submit

webhook = "My webhook"

event.OnServerEvent:Connect(function(player, feedback)
	local formatted = http:JSONEncode({
		content = chat:FilterStringAsync(feedback, player, player);
		username = (player.Name .. ' - [' .. player.UserId .. ']');
		avatar_url = ('https://www.roblox.com/headshot-thumbnail/image?userId=' .. player.UserId .. '&width=420&height=420&format=png');
	})
	http:PostAsync(webhook, formatted)
end)

but i'm getting a HTTP 400 (Bad Request) error. What do i need to fix?

2 comments

0

btw i have a webhook i just replaced it with My webhook

0

put the PostAsync in a pcall, all things with Async should be wrapped in a pcall since they can fail and pcall makes sure that even if they fail, the code wont break (does not mean you should have everything in a pcall)