How can I get the link of a player's headshot?

I’m attempting to build up a webhook for Discord, but I’m unable to get any player’s headshot link.

I tried using the Roblox API, but it simply gives me an error. I tried using GetUserThumbnailAsync, but it just gives me a rbxthumb link. I searched the developer forum but came up with nothing.

I’ve heard that node.js servers and proxies can be used to access the Roblox API, but I’m not sure how to set them up.

Assuming that you’ve already got a proxy set up since you’re sending requests to Discord’s /webhooks/{webhook.id}/{webhook.token} endpoint, you can use that proxy to also get thumbnails from Roblox’s API.

-- You can change the size query to that of your choosing, as long as Roblox
-- supports it.
local HeadshotThumbnailUrl = "https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=%d&size=150x150&format=Png&isCircular=false"

-- The "Proxy" value is assumed to be an instance of your proxy, and its
-- :Get() method used for executing GET requests.

-- Assume we have a Player instance from somewhere.
local response = Proxy:Get(HeadshotThumbnailUrl:format(player.UserId))

-- { data: [ { imageUrl: string } ] }
local headshotUrl = HttpService:JSONDecode(response).data[1].imageUrl

print(headshotUrl)
1 Like

I attempted to set up a proxy but it was a bit too complex for me. I know that i need one, its just that i’m having some trouble setting it up.

1 Like

Okay, please share:

  1. What service you are using
  2. What languages you are using for the lambda (i.e python, javascript, PHP)
  3. What guide you are following (if any)
  4. What you’ve done so far.
1 Like
local httpService = game:GetService("HttpService")

local URL = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=%s&size=150x150&format=Png&isCircular=false"
local userID = 0000

local response
local data

local success, err = pcall(function()
	response = httpService:GetAsync(URL:format(userID))
end)

if not success then
	print(err)
else
	data = httpService:JSONDecode(response).data[1].imageUrl
	print(data)
end

This is a script using the RoProxy service.

The data variable is the image link so if this used for a Discord webhook, the data variable can be used as the avatar.

2 Likes

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