Error 400 means that the issue is on your end. It could be due to you not encoding the message properly. Are you encoding it to JSON using HTTPService:JSONEncode() before-hand?
If it is even set to contents then the message should still be posted. I tested this myself and the text just doesn’t appear with setting it to contents. The issue is something completely different.
And replace the “USERIDHERE” text with your user ID and run a GetAsync on it. It would return a JSON table. After that, you can use JSONDecode to decode it and do response.data[1].imageURL for the players picture.
Just saying, the field “url” does not exist in the main body of the message but it does exist inside of the embeds. The URL will appear as a masked link as Discord calls it and you will be able to click on the title text to go to the link.
Hey,
First off, its important not to use the default webhook directly. Instead, you should use a proxy, because in Studio, the standard Discord webhook API should work. Your JSON encoding seems correct, but if errors occur ingame, it might be because Discord doesnt allow Roblox to send webhooks directly. In that case, you should use a proxy like webhook.lewisakura.moe.
Additionally, Im unable to see what the player picture is it could be nil or something else causing errors. I recommend printing out the value to check. The same goes for the Titles variable try printing it as well to debug.
This is not a URL and this asset is only valid for Roblox’s user not Discord. You should be using a proxy to send a get request to the Roblox APIs to get the actual avatar thumbnail URL. Here is how I would be getting the avatar thumbnail:
local thumbnailURL:string = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=%s&size=150x150&format=Png&isCircular=false"
local function getThumbnail(player:Player)
local userId:number = player.UserId
local response:string = nil
local success:boolean, errorMessage:string = pcall(function()
response = HTTPService:GetAsync(thumbnailURL:format(userId))
end)
if not success then
error(errorMessage)
else
return HTTPService:JSONDecode(response).data[1].imageUrl
end
end