Http(400)bad request on discord webhook proxy

Hey guys I’m making a webhook manager for developer use, and I’ve recently came into this error when trying to fire a webhook.

function WebhookManager:PostWebhook(content,title,user,custom,url,player_id,colour)
	if not content or not title or not user or not custom or not url then
		return warn("INVALID ARGUMENTS: "..script.Name)
	end
	local HookData = {
		['content'] = "```at "..os.date("%Y-%m-%d %H:%M:%S").."````",
		embeds = {
			{
				['type'] = tostring(custom),
				['title'] = tostring(title),
				['description '] = ">>",
				['colour'] = tostring(colour), 
				['author'] = {
					name = tostring(player_id),
					url = "https://www.roblox.com/users/"..player_id.."/profile"
				},
				['footer'] = {
					text = tostring(user)
				}
			}
		}
	}
	 HookData = HttpService:JSONEncode(HookData)
	local WebhookId,WebhookToken = tostring(url):match(".+/([^/]+)/([^/]+)$")
	 
	 if game:GetService("RunService"):IsStudio() then
		local success,response = pcall(function()
			return HttpService:PostAsync("https://webhook.newstargeted.com/api/webhooks/"..tostring(WebhookId).."/"..tostring(WebhookToken),tostring(HookData))
		end)
		if not success then 
			 return warn("webhook failed to fire: "..response)
		end
	 end
end
return WebhookManager

I’m really not sure what to do here, as I need this system working as apart of my logging system

It means the syntax of the request is invalid, check if you’ve sending data with correct syntax

The discord API uses american english, the correct key name is color and not colour.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.