Discord Webhook not working (Need help quickly)

local httpservice = game:GetService("HttpService")
local api = "https://discordapp.com/api/webhooks/747268872918532120/shk2LGXRX_4v5yRG9aUcJkgUn4dTsIUkR3FomaaRF1ZXkXwlaFR--w598AzdT-K0v32U"
local min = false
game.ReplicatedStorage.Report.OnServerEvent:Connect(function(p,user,reason)
	print('ager')
	wait()


		
	local data = {
		['embeds'] = {{
				["author"] = {
					["name"] = "Hard Obby Report";
					["icon_url"] = {url = game.Players:GetUserThumbnailAsync(p.UserId,Enum.ThumbnailType.AvatarBust,Enum.ThumbnailSize.Size352x352)};
				},
				["color"] = 392483,
				["title"] = p.Name,
				["fields"] = {
				{
					name="**Reported**",
					value=user,
				},
				{
					name="**Reason**",
					value=reason,
				},
				},
				["footer"] = {
					text="Made by iSyriux"
				}
			}}
		}
	local newdata = httpservice:JSONEncode(data)
	httpservice:PostAsync(api,newdata)
end)

This is my thing but it just shows error 400
image

HTTPservice is enabled
I am not the owner of the game, but I published the game

3 Likes

Sometimes the Bad Request event is due to HTTP, try it on client and not on studio, i had the same problem with PrivateTeleport bit on client and roblox server it worked

Also whoever was spamming β€œlol ■■■■■■” I hope you are happy with yourself

Yeah I published it and tried it on client but it still gives error

Have you enabled HTTP on your game?

1 Like

Are you joking? I literally said HTTPservice is enabled on the game, and it’s my game

I didn’t see it, other than that idk how to help, i never scripted something like this

This serves as a good lesson though. Be careful with where you post your webhook token.

Also, make sure you migrate to making discord API calls to discord.com, as they will be killing discordapp.com API calls at some point afaik.

Can’t immediately find anything wrong with your call. Can you try sending a simple 1 line message to that webhook to see if the issue is with your embed formatting?

Definately a formatting issue.
image

I was able to send this

local httpservice = game:GetService("HttpService")
local api = "no"
local min = false
game.ReplicatedStorage.Report.OnServerEvent:Connect(function(p,user,reason)
	print('ager')
	wait()


		
	local data = {
		['embeds'] = {{

				["color"] = 392483,
				["title"] = p.Name,
				
			}}
		}
	local newdata = httpservice:JSONEncode(data)
	httpservice:PostAsync(api,newdata)
end)

Hello?,

It’s still not working you know

Please help me I have to go soon

In author object in embeds, the icon url is not meant to be an object, yet it is meant to be a string

2 Likes

Then how do you make it a string

By converting it from an object to a string?

2 Likes

Ok my next problem is, how do you change the colour
I have put a colour but it always becomes green

image

That color isn’t valid

DEFAULT: 0,
AQUA: 1752220,
GREEN: 3066993,
BLUE: 3447003,
PURPLE: 10181046,
GOLD: 15844367,
ORANGE: 15105570,
RED: 15158332,
GREY: 9807270,
DARKER_GREY: 8359053,
NAVY: 3426654,
DARK_AQUA: 1146986,
DARK_GREEN: 2067276,
DARK_BLUE: 2123412,
DARK_PURPLE: 7419530,
DARK_GOLD: 12745742,
DARK_ORANGE: 11027200,
DARK_RED: 10038562,
DARK_GREY: 9936031,
LIGHT_GREY: 12370112,
DARK_NAVY: 2899536,
LUMINOUS_VIVID_PINK: 16580705,
DARK_VIVID_PINK: 12320855
1 Like

Just to be clear, are these integer representations of hex colors?

This in hex is #2ECC71
Yes they are integer representations of hex colorids

2 Likes