How to send a Discord webhook through Roblox

what exactly am i doing wrong here?

local data = {
['WebhookURL'] = 'https://discord.com/channels/959278678393634908/959278678393634912',
['WebhookData'] = {['username']='itchybarn', ['content']='Hello!'}
}
local https = game:GetService('HttpService')
local data = https:JSONEncode(data)
print('dfs')
local success,errorm = pcall(function()
https:PostAsync('https://bloxrank.net/api/webhook/', data, Enum.HttpContentType.ApplicationJson)
end)

Do any errors show up for you?

Discord has blocked Roblox from sending API requests to it, so it may just be because you are directly calling discord instead of a proxy service. I’m not sure if they removed the block however.

EDIT: Upon looking at your code it seems the webhook is invalid. It’s just a link to a server channel. I’d suggest looking at how to create a webhook, here.

But we’ll happily make sure action is taken upon you for saying this and allowing abuse towards Discord along with endorsing it.
:slight_smile:

1 Like

I keep getting HttpError: DnsResolve. I tried the code directly from the topic even, and I double checked the webhooks URL and my discord webhook URL.

Any reason I keep hitting this error? I’ve spent about an hour reformatting and trying different proxies like this one. Any help is seriously appreciated.

The code I’m using to test (directly used from the example):

That’s what google analytics is for, and Roblox even has a wrapper for it

thats weird, prob the endpoint doesn’t work

This doesn’t work for me, it says HTTP 403 forbidden?

My script:

local data = {
	['WebhookURL'] = 'https://discord.com/api/webhooks/thisisnthereonpurposeyouarentwebhookbombingmyserver:)',
	['WebhookData'] = {['username']='hookguy', ['content']='Hello!'}
}
local https = game:GetService('HttpService')
local data = https:JSONEncode(data)

local success,errorm = pcall(function()
	https:PostAsync('https://bloxrank.net/api/webhook/', data, Enum.HttpContentType.ApplicationJson)
end)
print(success,errorm)

2 years later, Module doesn’t work for me for some reason.

OP probably stopped maintaining the endpoint.

Darn. I guess I need to start my own proxy then :shrug:

You can use mine or Lewis’s.

3 Likes

I can confirm yours does work, however Lewis’s doesn’t.