Webhook does not send image

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

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to post a message in my discord server whenever a rare pet is hatched.

  2. What is the issue? Include screenshots / videos if possible!
    It creates a message, but excludes the image. This is what it looks like right now:
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve searched for it on the internet & I have tried different ways of aproaching this

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local thumbnailUrl = string.format("https://www.roblox.com/asset-thumbnail/image?assetId=%d&width=420&height=420&format=png", 12480403314)
	local Message = {
		["content"] = "",
		["embeds"] = {{
			["title"] = User.Name.." hatched a Secret "..Pet,
			["description"] = "`"..ExistString.."`",
			["type"] = "rich",
			["color"] = tonumber(0xff5927),
			["thumbnail"] = {
				["url"] = thumbnailUrl
			},		
		}}
	}
	HttpService:PostAsync(Webhook, HttpService:JSONEncode(Message))

It’s possible that the issue could be related to the way the image is being referenced in the webhook message. Here are a few things you can try:

  1. Check that the image URL is valid and returns an image when accessed in a web browser.
  2. Try adding a height and width property to the "thumbnail" table, like this:
["thumbnail"] = {
    ["url"] = thumbnailUrl,
    ["height"] = 420,
    ["width"] = 420
},
  1. You could also try adding a "image" table to the "embeds" table, like this:
["embeds"] = {{
    ["title"] = User.Name.." hatched a Secret "..Pet,
    ["description"] = "`"..ExistString.."`",
    ["type"] = "rich",
    ["color"] = tonumber(0xff5927),
    ["thumbnail"] = {
        ["url"] = thumbnailUrl,
        ["height"] = 420,
        ["width"] = 420
    },
    ["image"] = {
        ["url"] = thumbnailUrl,
        ["height"] = 420,
        ["width"] = 420
    }
}}
  1. Make sure that the webhook has the necessary permissions to display images in the channel where it’s being posted.

If none of these solutions work, you may need to provide more information about the error you’re experiencing or seek help from a developer familiar with the platform you’re working on.

2 Likes

The reason it did not work was because the URL was invalid. I also did step 3 to end up with this as a final result:
image

Thanks for helping.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.