Webhook suggestion script not working!

Hello Everyone!

im trying to make a roblox suggestion menu and im trying to make a remote event to send the suggestion/msg to the webhook.

but for some reason no errors are outputting and it does not work.

ive tried it in studio and in-game and both do not work :((

-- remote event code
local HTTP = game:GetService("HttpService")
local Webhook = ""

local Event = game.ReplicatedStorage.Remotes.Suggest

Event.OnServerEvent:Connect(function(player, userid, suggestion)
	local Embed = {
		["embeds"] = {
			{
				["title"] = "New Suggestion",
				["description"] = "**User ID:** ``" .. userid .. "``\n**Suggestion:** " .. suggestion,
				["color"] = 65280, -- Green color
				["footer"] = {
					["text"] = "Suggestion from " .. player.Name
				}
			}
		}
	}

	local Payload = HTTP:JSONEncode(Embed)

	local Success, Response = pcall(function()
		return HTTP:PostAsync(Webhook, Payload, Enum.HttpContentType.ApplicationJson)
	end)

	if not Success then
		warn("Failed to send suggestion: " .. tostring(Response))
	end
end)

and just to make sure im not fireing the remote wrong heres the gui button local script

-- local script that goes inside of the gui button!
local Event = game.ReplicatedStorage.Remotes.Suggest

script.Parent.MouseButton1Click:Connect(function() 
	Event:FireServer(game.Players.LocalPlayer.UserId, script.Parent.Parent.Parent.TextBox.Text)
end)

Discord blocks Roblox webhooks. I would recommend hosting a server on Glitch, or looking up some articles online for how to use a proxy server. Discord started blocking Roblox Server IPs because of how many games used Discord as a logging system, which had quite a toll on their servers.

1 Like

true i could but i dont know how to use glitch or know how to setup like a thing that sends requests
also i think if im wrong i would need to know JavaScript to know how to use it

Hello!

To get a status code response, let’s change over to RequestAsync. Could you replace your PostAsync code with this:

return HTTP:RequestAsync({
    Url = --[[webhook url]],
    Method = "POST",
    Headers = {
        ["Content-Type"] = "application/json"
    },

    Body = HTTP:JSONEncode(Embed)
})

And then, after the pcall code, can you do this:

print(Response.StatusCode)

and tell me what it outputs?


Discord doesn’t seem to block webhook requests from Roblox, at least from my experience. I’ve never actually needed to use a proxy to send webhook requests to Discord, so that might not be the issue. I’m pretty sure a blocked webhook request would also return HTTP 403 (forbidden).

But then again, it could well be the problem. We’ll find out with the status code.

1 Like

is this good?

local HTTP = game:GetService("HttpService")
local Webhook = ""

local Event = game.ReplicatedStorage.Remotes.Suggest

Event.OnServerEvent:Connect(function(player, userid, suggestion)
	local Embed = {
		["embeds"] = {
			{
				["title"] = "New Suggestion",
				["description"] = "**User ID:** ``" .. userid .. "``\n**Suggestion:** " .. suggestion,
				["color"] = 65280, -- Green color
				["footer"] = {
					["text"] = "Suggestion from " .. player.Name
				}
			}
		}
	}

	local Payload = HTTP:JSONEncode(Embed)

	local Success, Response = pcall(function()
		return HTTP:RequestAsync({
			Method = "POST",
			Headers = {
				["Content-Type"] = "application/json"
			},

			Body = HTTP:JSONEncode(Embed)
		})
	end)

	if not Success then
		warn("Failed to send suggestion: " .. tostring(Response))
	end
end)

2 Likes

Almost. Just use this code for the request sending and let me know what outputs.

    local Success, Response = pcall(function()
		return HTTP:RequestAsync({
            Url = --[[webhook url]],
			Method = "POST",
			Headers = {
				["Content-Type"] = "application/json"
			},

			Body = HTTP:JSONEncode(Embed)
		})
	end)

	if not Success then
		warn("Failed to send suggestion: " .. tostring(Response))
	end

    print(Response.StatusCode)
2 Likes

Just to avoid an overload of requests via Webhook, I would recommend that you store the suggestions on the server and have it send them periodically, instead of whenever a RemoteEvent is called.

i got Status Code: 404 when i used this.

i like your idea but first i need to find why it does not work and gives Status Code: 404

and yes i enabled https request in settings

fixed it someone deleted my webhook i left the url in there lol

oh! I see. Well, the code 404 (page not found) makes sense then. Glad you fixed it.

I suppose my post doesn’t really deserve to be marked as solution, unless the 404 outputting helped you find the issue. Please consider marking yours as solution instead if my post didn’t help.

no the code was wrong then you fixed it then when i posted this someone deleted my webhook

1 Like

Something could have changed, @Alfiepro98234 double check this works in game, not just studio. There was an issue for quite a while where Discord would block any request from a Roblox IP: Is there any way that I can send a message to discord? [SOLVED] - #5 by Pixelctrl Send a message from your Roblox game to Discord! - #4 by xtntt. Just want to make sure this is a permanent solution for anyone coming across this post in the future.

1 Like

i got status code 429 witch means there are too many requests.

I’m aware it used to be a major issue, I’m not so sure now. It seems to be inconsistent. I hear of some people needing a proxy and some people not. Could be to do with the webhook itself, like when it was made (complete guess), but I wouldn’t rule blocked requests out as a cause of webhook problems.

Checking the status code always seems to help, so I just wanted to double check it here. Pretty sure Discord would return 403 for blocked requests, but don’t quote me on that.


I found this by searching your webhook URL in Google.
From now on, make sure you don’t post sensitive information in public forum posts. An anonymous imageboard found your webhook and pretty much bricked it, so you won’t be able to use it ever again.

ok can’t I just make another web hook?

If you can keep it private, yes.