Buttons are not being displayed with discord webhook and http service

So my code is sending the message and embeds but not the buttons,
i cant figure it out and i cant seem to find anything on this.

local HttpService = game:GetService("HttpService")



local webhookUrl =


local function sendDiscordMessage()
	local data = {
		["content"] = "test test test",
		["embeds"] = {
			{
				["title"] = "Sample Embed",
				["description"] = "regggee",
				["color"] = 7506394
			}
		},
		["components"] = {
			{
				["type"] = 1,
				["components"] = {
					{
						["type"] = 2, 
						["label"] = "Primary tg",
						["style"] = 1,
						["custom_id"] = "button_1" 
					},
					{
						["type"] = 2, 
						["label"] = "Visit rrree",
						["style"] = 5, 
						["url"] = "https://devforum.roblox.com"
					}
				}
			}
		}
	}
	local jsonData = HttpService:JSONEncode(data)
	local success, response = pcall(function()
		return HttpService:PostAsync(webhookUrl, jsonData)
	end)

	if success then
		print("Message sent successfully!")
	else
		warn("Failed to send message: " .. response)
	end
end
wait(4)

sendDiscordMessage()

any help is greatly appreciated.

1 Like

Discord blocked requests from roblox, you must use a proxy instead. There’s a few out there that you can try out

Also don’t share your webhook link publicly

2 Likes

I wish I hadn’t shared the webhook link by accident, cuz people are sending some very bad stuff in my server

But thanks for your help, I will try the solution

To who ever sent furry NSFW furry “images” I sincerely hate you ( I will find you )

STOP SENDING BRAINROT

Special thanks to the dude who sent me a solution through my web hook. Thanks for the solution @steechyy

Thanks to whoever sent a cat-owl
I’m deleting the web look so the url you guys had is now
——————-

2 Likes

ok the proxy didnt work sadly :frowning:

hi, what error are you recieving? is the proxy you’re using working correctly? you should check that first!!

also, you could attempt to only send a normal message, and then, everytime it works, add more elements of the embed you want to send. this way you can instantly see where you made an error and where you can try to fix it !! atleast, that’s how i’d do it

1 Like

Edit: I dont think I can send the component buttons through a webhook, Ill figure out a different way to do this, thanks for your help

i looked around a bit, yeah, not sure if webhooks work with buttons. incase u can’t find a way, you could try using hyperlinks instead !! They are clickable and can lead u to websites, if that works as an alternative for u !!

Try this proxy:

Its very simple to use.

alright, after a bit of testing, googling, asking people, I found a way to send buttons.

This might be a bit of a big workaround, and I’m not sure if it’s worth it for you, but i’ll tell u what i did to get it working !!!

Apparently, to make webhooks send buttons, that webhook has to be created by a discord bot. why? no clue why

So what you’ll have to do is make a javascript program control a discord bot that creates a webhook for you. I threw together a quick thingy which you can copy to be your index.js code. I cant go into great detail on how to setup a discord bot, so you should watch a tutorial i found on youtube, which should help u set it up!!

Do what the guy says, he tells you everything from making a discord bot to starting it. u can use the code that linked earlier to be the index.js code, start the bot ( he tells you how to in the tutorial ) and just type a message in the discord chat you wish your webhook to be in ( don’t forget to invite ur bot with administrator permissions beforehand!!! just to be sure )

After that, look in your console of your program where you made the bot (in my case, it’s vscode). It should print the link to your webhook


this webhook is deleted don’t even bother trying lol

just copy the url and replace the webhookURL with the thing u copied. I tried to use @InternalSecurityPoss’ webhook proxy, but it unfortunately returned a server error, the normal discord webhook url seems to work just fine.

In conclusion, to make a discord webhook be able to send buttons, it has to be created by a discord bot. the script you gave earlier is completely correct, ive tried it, it’s just a weird feature by discord which I cant really explain to myself.

i hope i was able to help, if there’s any further questions or if i was bad at explaining feel free to ask!!!

1 Like

Thank you so much! I had no idea the discord bot had to create it

1 Like

yw!! i am glad to have helped u!!

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