Trying to get User Profile Picture for Discord Webhook

I can’t seem to find on how to get avatar URL

	local URL = " " -- Discord Webhook

	local Proxy_Service = require(game.ServerScriptService.Proxy_Service)

	Proxy_Service:New(" ") // Proxy Server

	local Data = {
		['embeds'] = {{
			['title'] = "**New trade**",
			["avatar_url"] = "https://media.discord.com/attachments/[number]/[number]/x.png?width=401&height=401",
			['description'] = Player_Who_Accepted .. " has accepted a trade. They received: "..Accepted_Value.." and gave "..Sent_Value,					

		}}
	}

	local Final_Data = Http_Service:JSONEncode(Data)

	Proxy_Service:Post(URL,Final_Data)
	
	Trade_Information[Id]:Destroy()
	
	
	
end)```
1 Like

Set the thumbnail field to a URL that corresponds to the player image from GetUserThumbnailAsync (Players:GetUserThumbnailAsync)

local Players = game:GetService("Players")
local url = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

["thumbnail"] = {
    ["url"] = url
},

This is a very barebones example. This makes a web call so you should wrap it in a pcall and error handle and whatnot.

You can also use the available thumbnail API endpoints.
https://thumbnails.roblox.com/docs#!/Avatar/get_v1_users_avatar
Here’s a sample request for Roblox’s avatar’s thumbnail.
https://thumbnails.roblox.com/v1/users/avatar?userIds=1&size=30x30&format=Png&isCircular=false
The ‘imageUrl’ field of the JSON encoded response is what you’re looking for.

6 Likes

Cool, Thanks for the API Endpoints!