HttpService Bad Request

Hey recently I’ve been working on a TextBox where you can create a team with that specific text in the textbox and I am trying to make it loggable but it is giving me the error.
HTTP 400 (Bad Request)

Could someone help me, thanks.

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player,text)
	local team1 = Instance.new("Team")
	team1.Parent = game.Teams
	team1.Name = tostring(text)
	team1.TeamColor = BrickColor.Random()
	Player.Team = team1
	print("Team "..text.. " created by "..Player.Name)
	local webhook = "1"
	local teamLogData =
		{
			['contents'] = "",
			['embeds'] = {{
				['title'] = "__**Team Creation Logs**__",
				['description'] = "**A new Team has been created!**",
				['type'] = "rich",
				['color'] = tonumber(14177041),
				['fields'] = {
					['name'] = "Player Name",
					['value'] = Player.Name,
					['inline'] = true
				},
				{
					['name'] = "Team Name",
					['value'] = team1.Name,
					['inline'] = true
				}
			}}
		} 
	local newData = HttpService:JSONEncode(teamLogData)
	HttpService:PostAsync(webhook,newData)
end)

Please don’t give us the webhook link, people could abuse it and have your account banned for spamming the webhook.

Also yeah, it’s ‘content’, not ‘contents’

Bad request also means you likely messed up the format.

1 Like
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player,text)
	local team1 = Instance.new("Team")
	team1.Parent = game.Teams
	team1.Name = tostring(text)
	team1.TeamColor = BrickColor.Random()
	Player.Team = team1
	print("Team "..text.. " created by "..Player.Name)
	local webhook = "1"
	local teamLogData =
		{
			['content'] = "",
			['embeds'] = {{
				['title'] = "__**Team Creation Logs**__",
				['description'] = "**A new Team has been created!**",
				['type'] = "rich",
				['color'] = tonumber(14177041),
				['fields'] = {
					['name'] = "Player Name",
					['value'] = Player.Name,
					['inline'] = true
				},
				{
					['name'] = "Team Name",
					['value'] = team1.Name,
					['inline'] = true
				}
			}}
		} 
	local newData = HttpService:JSONEncode(teamLogData)
	HttpService:PostAsync(webhook,newData)
end 
Try this
1 Like

Adding on:

https://devforum.roblox.com/t/discord-integration-a-guide-on-using-discord-through-roblox-updated/47090

https://devforum.roblox.com/t/how-do-you-make-a-discord-webhook-send-an-embed-message/279272

1 Like

It is still giving me that problem.

I suggest you to read discord webhook again and check if there is any mis-spelling