How would i add a field to a discord webhook?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I am currently making a logging system, I want to make the webhook look more organized with fields

  2. What is the issue? Looking from examples in discohook I couldn’t figure out how to add fields in Roblox

  3. What solutions have you tried so far? I have tried searching for answers but it seems I couldn’t find one.

Here is the code

			if Config.WebhookEnabled == true then
				getav(lastscanneduser, "100x100")
				local data =	{
					['avatar'] = imageurl,
					['username'] = "Open",
					['embeds'] = {{
						["field"] = {
							["idk"] = {
								["uh"] = "uh"
							},
						},
						['title'] = Config.TurnstileName,
						['description'] = "Turnstile opened by " .. lastscanneduser.Name,
						['color'] = 65331,
						["footer"] = {
							["text"] = os.date("Portal Technologies • %x %H:%M")
						}
					}}
				}
				local finaldata = HTTP:JSONEncode(data)
				HTTP:PostAsync(WebhookURL, finaldata)
			end

If there is something missing from my post please do tell me!

						{
							["name"] = value,
							["value"] = value
						}
}
local HttpService = game:GetService ("HttpService")
local webhook = "" -- Put webhook here

local data = {
	["embeds"] = {{
		["title"] = Config.TurnstileName, 
		["color"] = 65331,
['avatar'] = imageurl,
['username'] = "Open",
	['title'] = Config.TurnstileName,
						['description'] = "Turnstile opened by " .. lastscanneduser.Name,
						['color'] = 65331,
					    ["footer"] = {
							["text"] = os.date("Portal Technologies • %x %H:%M")
						}
		["fields"] = {
			{
				["name"] = "", -- This is  the title of your field.
				["value"] = "" -- This is the value of your field.
			}
		}}
	}
	}

	local jsonData = HttpService:JSONEncode(data)
	HttpService:PostAsync(webhook, jsonData)
1 Like

Believe it is the same you did, but yeah. I’ve seen it be done like this too:

		["fields"] = {
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				},
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				}
2 Likes

Let me test. ------------------------

This works, thank you very much!

Anytime, have a good day!! Happy coding. :keyboard:

1 Like