Webhook not sending

My discord webhook isn’t working? But no clue why I keep getting an error: HTTP 400

Code:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, auth, level, admin)

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

local webhook = "https://discord.com/api/webhooks/id"


	local data = {
		content = "Remote event fired! Data:"..auth, level, admin;
		username = plr.Name;
		avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..plr.UserId
	}

HttpService:PostAsync(webhook, HttpService:JSONEncode(data))

end)

I don’t see anything work, doesn’t work with a new webhook either!

Could this be a roblox problem?

1 Like

Please first remove your Webhook link someone could use it.
And 2nd try using pcall for your PostAsync() and print any error that can occur maybe it can give you a clue on why it’s not working.

This isn’t necessarily a problem with Roblox.

Some User-Agents Roblox uses are blocked by Discord as people used to spam fire webhooks from Roblox so Discord blocked them.

Please censor part of this! You leaked your webhook URL!

1 Like

If it gets spammed ill just replace it, so no worry.

I get an error http 400. But I don’t know what it means.

400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Okay, so make these [“content”] or [“description”], no caps.
I recommend encrypting the data before.
so

local Data = HttpService:JSONEncode(data)
HttpService:PostAsync(webhook, Data)

Oh, and don’t use ;. Use ,.
So a fixed version of your script is this:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, auth, level, admin)

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

local webhook = "https://discord.com/api/webhooks/id"


	local data = {
		["content"]= "Remote event fired! Data:".. tostring(auth) .. tostring(level ).. tostring(admin),
		["username"] = plr.Name,
		["avatar_url"] = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..plr.UserId
	}
local data = HttpService:JSONEncode(data)
HttpService:PostAsync(webhook, data )

end)

The [“description”] is for embeds.

Yeah, just giving examples, sorry if it’s confusing.

Just saying, so they won’t get an error.

1 Like

You should add something seperating these otherwise it will be a mess.

"Remote event fired! Data: ".."Auth: ".. tostring(auth) .."Level: ".. tostring(level ).."Admin Level: "..tostring(admin),

or

"Remote event fired! Data:".." ".. tostring(auth) .." ".. tostring(level ).." "..tostring(admin),

Or something like this :+1:

string.format("Remote event fired! Data: Auth: %s | Level: %s | Admin: %s", auth, level, admin)