Sends "Bad Api Request" even tho its good?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im trying to make it so when a player joins it sends a message to a webhook on my discord with a button

  2. What is the issue? Include screenshots / videos if possible!
    Just says “Error 400 (Bad Request)” in the console.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked and they all tell me to use WebhookProxy or smth like that, but i wanna do it with a simple api request

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local HTTPService = game:GetService("HttpService")

local url = ""

	local data = {
		["content"] = "Player joined the game: "..plr.Name,
		["components"] = {
				["type"] = 2,
				["label"] = "Click me!",
				["style"] = 5,
				["url"] = ""
	local encodeddata = HTTPService:JSONDecode(data)
	HTTPService:PostAsync(url, encodeddata, Enum.HttpContentType.ApplicationJson, false)

edit: i know its not that the script is wrong because i’ve checked the dev portal on discord

1 Like

The 400 error code means your request was not formatted properly and was unable to be processed by ther web server.

This appears to be your problem. You should be using JSONEncode instead of Decode.


Where are you testing the code? Iirc discord blocks Roblox api requests because of spamming or something. You have to use a proxy to send data to the web hook.

1 Like

Fixes 400, gets 403.


Unsure if it’s been reverted or not, but Discord blocked all traffic from Roblox game servers so webhooks may not work.

I don’t believe webhook messages can have message components as they are only for messages from a bot account in a Discord application.

This is most likely your issue, use JSONEncode instead.

1 Like

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