Roblox Webhook Images

I want an embed sent to a webhook when a module is required.

The webhook sends just fine, however, the image that I try to send doesn’t load. I’ve checked to make sure that it isn’t my internet; it isn’t.

I’ve looked on the developer hub and found Imgur.

Module Code
return function()
	local Configuration = {
		{
			Log = "Server Shutdown",
		},
	}
	local WebhookMessage = {
		["username"] = "Game Shutdown",
		["avatar_url"] = "",
		["content"] = "this would ping everyone but i had to remove it so it doesnt spam ping everyone 500 times",
		["embeds"] = {{
			["title"] = "Server has shutdown!",
			["description"] = "**Our server has shutdown due to an update or fix.**\n\nStuck? Follow these steps below:\n\n1.Take a screenshot of your screen before you did anything.\n2. Send that screnshot to [here](https://discordapp.com/channels/1131955683974184980/1198490658298679296)\n3. Click the play button on the games' page again\n\nThen you're done!",
			["type"] = "rich",
			["color"] = tonumber(0xffffff),
			["image"] = {
				["url"] = 'https://imgur.com/XFssN5k',
				["height"] = 11,
				["width"] = 11,
			}
		},
		}

	}
	local JSONTable = game.HttpService:JSONEncode(WebhookMessage)
	task.delay(.5,function()
		game.HttpService:PostAsync('webhook', JSONTable)
	end)
end
ServerScript Code
revoked = {}
local function RunningOn(runservice:RunService)
	if runservice:IsStudio() then
		return 'Studio'
	elseif runservice:IsClient() then
		return 'Client'
	elseif runservice:IsServer() then
		return 'Server'
	end
end
local log = require(script.Logging)
game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(m)
		local prefix = "!"
		local new,ret
		local split = m:split(prefix)
		local cmd = split[2]
		local args = m:split(" ")
		if player:GetRankInGroup(32637334) > 251 and not table.find(revoked,player.UserId) then
			if cmd == 'softshutdown' then
				local Suceess,ErroRet = pcall(function()
					for a,b in next,game.Players:GetPlayers() do
						local ui = script.SoftShutdown:Clone()
						ui.Parent = b.PlayerGui
						ui.LocalScript.Enabled = true
						local misc=require(script.Misc)
						misc()
						task.wait(5)
						new,ret = pcall(function()
							game["Teleport Service"]:Teleport(game.PlaceId,b,nil,nil)
						end)
					end
				end)
				task.wait(6)
				if (Suceess) then
					if (new) then
						log(player,RunningOn(game:GetService("RunService")),m,tostring(Suceess),tostring(ret))
					elseif not (new) then
						log(player,RunningOn(game:GetService("RunService")),m,tostring(Suceess),tostring(ret))
					end
				elseif not (Suceess) then
					if (new) then
						log(player,RunningOn(game:GetService("RunService")),m,tostring(ErroRet),tostring(ret))
					elseif not (new) then
						log(player,RunningOn(game:GetService("RunService")),m,tostring(ErroRet),tostring(ret))
					end
				end
			elseif cmd == 'lockdownstart' then
				task.wait(.1)
				game.ReplicatedStorage.Lockdown.Start:FireAllClients(true)
				log(player,RunningOn(game:GetService("RunService")),m,nil,nil)
			elseif cmd == 'lockdownend' then
				task.wait(.1)
				game.ReplicatedStorage.Lockdown.Start:FireAllClients(false)
				log(player,RunningOn(game:GetService("RunService")),m,nil,nil)
			end
		end
	end)
end)

-- Player, RunningOn, M, Result, Result

Please note that the webhook was removed and replaced with ‘webhook’. The webhook is not the problem.

Here is what the embed currently looks like:

1 Like

Have you tried using the image address instead of the imgur link? (right click on the image > copy image address)

https://i.imgur.com/XFssN5k.png
			["image"] = {
				["url"] = 'https://i.imgur.com/XFssN5k.png',
				["height"] = 11,
				["width"] = 11,
			}

I do not see ‘Copy image address’, I see what’s in this image:
image

I used the link you gave me and the ‘Copy image link’ but it didn’t send at all.

“Copy Image link”. update us on what happens.

I meant right click on the image from this:

https://imgur.com/XFssN5k

image

Can you share your updated code for the ModuleScript?

I did both, both yielded no results.

return function()
	local Configuration = {
		{
			Log = "Server Shutdown",
		},
	}
	local WebhookMessage = {
		["username"] = "Game Shutdown",
		["avatar_url"] = "",
		["content"] = "this would ping everyone but i had to remove it so it doesnt spam ping everyone 500 times",
		["embeds"] = {{
			["title"] = "Server has shutdown!",
			["description"] = "**Our server has shutdown due to an update or fix.**\n\nStuck? Follow these steps below:\n\n1.Take a screenshot of your screen before you did anything.\n2. Send that screnshot to [here](https://discordapp.com/channels/1131955683974184980/1198490658298679296)\n3. Click the play button on the games' page again\n\nThen you're done!",
			["type"] = "image",
			["color"] = tonumber(0xffffff),
			["image"] = {
				["url"] = 'https://i.imgur.com/XFssN5k.png',
				["height"] = 11,
				["width"] = 11,
			}
		},
		}

	}
	local JSONTable = game.HttpService:JSONEncode(WebhookMessage)
	task.delay(.5,function()
		game.HttpService:PostAsync('webhook', JSONTable)
	end)
end

I did copy it from the site.

Try this instead, you don’t need the width, height, and type keys:

local WebhookMessage = {
		["username"] = "Game Shutdown",
		["avatar_url"] = "",
		["content"] = "this would ping everyone but i had to remove it so it doesnt spam ping everyone 500 times",
		["embeds"] = {{
			["title"] = "Server has shutdown!",
			["description"] = "**Our server has shutdown due to an update or fix.**\n\nStuck? Follow these steps below:\n\n1.Take a screenshot of your screen before you did anything.\n2. Send that screnshot to [here](https://discordapp.com/channels/1131955683974184980/1198490658298679296)\n3. Click the play button on the games' page again\n\nThen you're done!",
			["color"] = tonumber(0xffffff),
			["image"] = {
				["url"] = 'https://i.imgur.com/XFssN5k.png',
			}
		}}
	}

What do you mean by “no results”? Did it not send a message (check console for errors) or did it send but it was the same output you got from the start?

Did not send a message:

Using the code you provided, still did not provide an embed:

Well, you could try adding a print line just before the :PostAsync to see if it’s actually requesting to the webhook, but other than that I’m not sure how else I can help you.

It is requesting:

Code (Module)
return function()
	local Configuration = {
		{
			Log = "Server Shutdown",
		},
	}
	local WebhookMessage = {
		["username"] = "Game Shutdown",
		["avatar_url"] = "",
		["content"] = "this would ping everyone but i had to remove it so it doesnt spam ping everyone 500 times",
		["embeds"] = {{
			["title"] = "Server has shutdown!",
			["description"] = "**Our server has shutdown due to an update or fix.**\n\nStuck? Follow these steps below:\n\n1.Take a screenshot of your screen before you did anything.\n2. Send that screnshot to [here](https://discordapp.com/channels/1131955683974184980/1198490658298679296)\n3. Click the play button on the games' page again\n\nThen you're done!",
			["color"] = tonumber(0xffffff),
			["image"] = {
				["url"] = 'https://i.imgur.com/XFssN5k.png',
			}
		}}
	}
	local JSONTable = game.HttpService:JSONEncode(WebhookMessage)
	task.delay(.5,function()
		print('its requesting')
		game.HttpService:PostAsync('webhook', JSONTable)
	end)
end

What URL are you requesting to? A https://discord.com/api/webhooks/ url or a proxy server? IIRC Discord blocks any request for webhooks coming from Roblox servers which is why people use proxy servers.

I am using Newstargeted.

WebhookProxy - A Discord webhook proxy, primarily for Roblox games (newstargeted.com)