Introduction
Recently, Discord have blocked any Roblox related server IPs (Internet Protocols) from being able to send webhooks to Discord channels. You are still able to send them in studio since your own IP is being used when use press the play button on roblox studio. The reason that they have decided to do this is that most commonly webhooks are used for things such as to relay chats, and if a big game such as Adopt Me were to do this (which they were), a channel could be receiving over 10,000 chats a second.
Tutorial Requirements
For this tutorial, you will need to know how to use the Discord webhook API (Application Program Interface) and how to send a basic HTTP POST request using Roblox Studio.
If you do not know how to do this, you can find out how using the links below:
[Discord Webhook API]
[Roblox Post Documentation]
Send Webhook
To send a webhook from a Roblox server, you’ll have to use the Bloxrank API. The URL to send a webhook from roblox is: https://bloxrank.net/api/webhook
Now we know the URL we need to use, lets get straight to specifying our parameters. This API has two fields WebhookURL
and WebhookData
. We’ll specify these fields later on in the tutorial.
Since we’ve learnt the fundamentals, we’re ready to start building our code. You’ll want to create a table below such as the following. In my webhook I’ll be sending a webhook of me saying Hello!
.
local data = {
['WebhookURL'] = 'https://discord.com/webhook/blahblahblah'
['WebhookData'] = {['username']='xG_andalf', ['content']='Hello!'}
}
Now we have the table, we’ll need to encode it ready to be sent to the Bloxrank servers. We’ll need to add a new variable called https
local data = {
['WebhookURL'] = 'https://discord.com/webhook/blahblahblah'
['WebhookData'] = {['username']='xG_andalf', ['content']='Hello!'}
}
local https = game:GetService('HttpService')
local data = https:JSONEncode(data)
Lastly, we’ll need to send our webhook, we can do this by using the https:PostAsync
function. We’ll need to make sure that our content type is set to application/json
. I’ve gone ahead and added a pcall function, which will catch any errors in the request which won’t spam your console or break your script.
local data = {
['WebhookURL'] = 'https://discord.com/webhook/blahblahblah'
['WebhookData'] = {['username']='xG_andalf', ['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, content_type=Enum.HttpContentType.ApplicationJson)
end)
If this helped you, please leave a like on this post. If you’d like to use Bloxrank for ranking users from Discord, you can invite it at: https://bloxrank.net/