Hello, My name is Rizzy.
Currently, im trying to create a system where if the player hatches a “Secret” pet for example, it shows up on discord as hatched. But everytime I hatch the hatch the pet, I get “HTTP 400 (Bad Request)” I’ve tried tons of solutions and so far nothing has helped. Any help would be amazing.
Here’s the script:
local httpService = game:GetService("HttpService")
local webhookURL = "https://hooks.hyra.io/api/webhooks/"
local data = {
['embeds'] = {{
['author'] = {
['name'] = tostring(Result).." Pet Hatched!",
['icon_url'] = game:GetService("Players"):GetUserThumbnailAsync(Rarity.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150),
},
['description'] = tostring(Rarity).." hatched "..tostring(Result).." "..tostring(Percentage).." ("..tostring(petpercent).."%) ",
['color'] = 16771072
}}
}
local finalData = httpService:JSONEncode(data)
httpService:PostAsync(webhookURL, finalData)
game.ReplicatedStorage.EggFolder.PetReproduced:FireAllClients(Rarity,Result,Percentage,petpercent,RarityColor)
end)```
You are sending the request to hooks.hyra.io/api/webhooks and you are not specifying your webhook id and token in the URL and so you are receiving http 400. Also do not use discord as a logging service.
I’m pretty new to this so im not sure what you mean. I do have my webhook id, I just didn’t add it to the post. I’m trying to create something like this which most pet games have in their discord server.
You must replicate your webhook’s URL into the URL you are using. Template: https://hooks.hyra.io/api/webhooks/Guild_ID/Webhook_secret the last two params in this URL are the last two params in the URL you get from discord
Based on your error, I’m assuming you forgot to enable HTTP requests in Game Settings, but if you already did, I recommend going through this post.
I’d also recommend using the pcall() function, as it is good in-case PostAsync would fail, so you get elaboration to what caused the error.