Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

HTTP 400: Bad Request when adding a webhook?

Asked by 3 years ago
Edited 3 years ago

Hi Everyone!

I wanted to make a webhook in my discord server that will take certain text posted by the server in the roblox chat onto a channel in my discord server. Since the text can only be sent through a local script, i use a remote event to tell another script to send the text to the discord server. Here is some of the local script:

local text = {
            ["Data"] = player.Name .. " Has Beaten " .. message .. " in " .. timebeaten .. "!" .. extra
        }
local encodedText = http:JSONEncode(text)
game.ReplicatedStorage.Completion:FireServer(encodedText)

Here is how the script takes the event and attempts to post the message in the discord server

http = game:GetService("HttpService")

game.ReplicatedStorage.Completion.OnServerEvent:Connect(function(encodedText)
    http:PostAsync("[the webhook lol]", encodedText)
end)

For some reason, the output is returning "HTTP 400: Bad Request", and it takes me to the PostAsync line. The URL of the webhook is accurate as well, its just not fully seen in the code block. Can someone tell me whats wrong?

Any help is appreciated :)

0
make sure you dont add the webhook raid6n 2196 — 3y
1
You should hide your webhook, remember other people could use it and try and falsely get your discord account terminated! nekosiwifi 398 — 3y

2 answers

Log in to vote
1
Answered by
tomekcz 174
3 years ago

u just leaked ur webhook link i think lol

Ad
Log in to vote
0
Answered by 3 years ago

You are incorrectly giving data to the webhook. There is no "Data", I believe you meant "content", which is the content of the webhook message.

Also, be careful of your structure because an exploiter could use the remote event to send their own message instead of the actually intended message and that since you are using PostAsync, you cannot see if you've hit the rate limit so be careful if you spam it.

RequestAsync can read for rate limits however.

Answer this question