How can I send an image to a discord webhook?

Before you flag this as duplicate and go, I wanted to tell you that I have used LITERALLY EVERYTHING I could find to send an image inside an embed.
Hey guys,
Today am scripting a discord webhook for the first time, and well am running into problems while trying to send an image to the embed. Here’s my code:

local HTTP = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(player)
	local data = {
		["embeds"] = {{
			["avatar_url"] = {url = tostring(game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420))},
			["description"] = "Player " .. player.Name .. " joined the game!",
			["color"] = tonumber(0xFFFAFA),
			["fields"] = {
				{
					["name"] = "Account Age",
					["value"] = player.AccountAge.. " days",
					["inline"] = true
				},
				{
					["name"] = "User ID",
					["value"] = player.UserId,
					["inline"] = true
				}
			}
		}},

	}
	local finaldata = HTTP:JSONEncode(data)
	HTTP:PostAsync("https://discord.com/api/webhooks/MyWebhook", finaldata)
end)

Result:
2021-07-23 (2)
I also tried the “author” method to no avail. Please help me, thanks.

Not sure if you want to achieve the same, but after a quick search I found this post Sending Images with webhooks - #16 by Luacrative Hope it helps.

1 Like

According to the Discord API you can attach an image and thumbnail to the embed.

1 Like
["thumbnail"] = {["url"] = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. player.UserId .. "&width=150&height=150&format=png"},

Is the correct field (I think) for getting the player’s PFP, you can use this & replace ["avatar_url"]

5 Likes

Used that too, no avail. Will check again tho

This won’t solve your question, but it’s worth mentioning something I said the other day which relates to this:

2 Likes

Ik that, I was just practicing, i wont dare to use it in a real game lol

2 Likes