Need help with embed structure

I need help with a embed structure, I am trying to add a footer but when it runs I get error 400. Here is my code

local HttpService = game:GetService("HttpService")

local function twoDigitsString(n)
	if n == 0 then
		return "00"
	elseif n < 10 then
		return "0" .. n
	else
		return tostring(n)
	end
end

local EST_SECONDS = os.time() - 14400
local date = os.date("!*t", EST_SECONDS)
	
local textDate = date.year .. "-" .. twoDigitsString(date.month) .. "-" .. twoDigitsString(date.day)
local textTime = twoDigitsString(date.hour) .. ":" .. twoDigitsString(date.min) .. ":" .. twoDigitsString(date.sec)

game.Players.PlayerAdded:Connect(function(player)
	local data = {
		["content"] = "",
		["embeds"] = {{
				["title"] = "Join Logs",
				["type"] = "rich",
				["color"] = tonumber(0xffffff),
				["fields"] = {
					{
						["title"] = "Player: ",
						["value"] = player.name,
						["inline"] = true,
					},
					{
						["title"] = "User Id: ",
						["value"] = player.UserId,
					}
				},
				["footer"] = {
					{
						["icon_url"] = "",
						["value"] = "Player joined: "..textDate.." at "..textTime,
					}
				}
			}}
	}
	
	
	local newdata = HttpService:JSONEncode(data)
	
	HttpService:PostAsync("Webhookurl", newdata)
end)
1 Like

I don’t see anything wrong with your code. A 400 status code often indicates that the URL to which you are sending data, is incorrect. Are you sure your webhook URL is not invalid?

Let me try a new webhook.

30 Chars

It seems to be a issue with the structure.

@ExcessEnergy Can you think of a issue with the structure?

Sorry it took me so long to respond. Actually, I am fairly certain it is a problem with the URL you are sending the data to. It’s not a problem with what you are sending, but the location you are sending it to. PostAsync is returning that the Server that is processing your request, is not happy and doesn’t know what to do.

Well its a discord webhook I can’t think of why discord would be rejecting the data.

Can I see in more detail, where you are sending the data. So I can make sure you are doing it correctly?