A tutorial on how to set up a Discord webhook for your game! (Only works in studio) Proxy is needed for game

Before you start, make sure that you have enabled HTTP requests in the game settings.

To start, you will need a Discord Webhook. To create one, go into server settings.
Then go into integrations

image

Then create a webhook.

image

The channel is the channel the webhook will operate in. (Like sending messages)
Once you have finished, copy your webhook URL and keep it for later.

image

Once that is done, head into the studio and create a script, and in that script, put your webhook URL in a variable. Make sure to add the HTTP service. It should look something like this:

local WebhookURL = "Webhook url here"
local HTTP = game:GetService("HttpService")

Next, we need to set up something to send data to the Discord webhook.

Create a table called “Data” inside it, add ["content"] = "Hello!" When you are done, it should look like this:

local Data = 
{
		["content"] = "Hello!"
}

For more info on how this works, you can go to Discord Developer Portal

Next to convert it to a JSON so our webhook doesnt error do:
Data = HTTP:JSONEncode(Data)

Lastly we need to send our data by:

HTTP:PostAsync(WebhookURL, Data, Enum.HttpContentType.ApplicationJson)

The finished code should look something like:

local WebhookURL = "Webhook url here"
local HTTP = game:GetService("HttpService")

local Data = 
{
    ["content"] = "Hello!"
}


Data = HTTP:JSONEncode(Data)

HTTP:PostAsync(WebhookURL, Data, Enum.HttpContentType.ApplicationJson)

When you run it you should see this:
image
If so you have finished the tutorial.
Congrats!

Well I hope this helped anybody trying to do this.

4 Likes

Why is this not in community tutorials?

1 Like

That was a mistake must have not read it properly thanks!

also this wouldn’t work (as far as I know)
as discord blocks webhooks from roblox you need a proxy
https://hooks.hyra.io/

From what we know, Roblox releases updates without telling us sometimes.

well this isn’t roblox blocking it its discord

It seemed to work in my testing

Actually, I believe it is from both sides though.

if you try ingame it won’t work

I’ll test it out really quickly to see if it works.

Right, so as @Carrotoplia had said, discord did block the requests from in-game to avoid major spams as usual. So perhaps having a proxy placed into the script could save time from others.

Discord blocked Roblox Request but because when run Testing in Studio it runs over your Computer the HTTP Requests doesnt get blocked