Skip to main content

Social

For player identity and registration state, see Player. For profile data formatted for UI, use the social module documented below. It handles avatar size selection and requests a Godot-decodable image format for you.

Player avatar​

Each registered user on Jest can set up a profile with a customizable avatar. JestSDK.social.get_profile(avatar_size) returns the current player's username and a resized avatar URL, matching the HTML5 social profile API while accounting for Godot image loading. The avatar URL routes through Cloudflare Image Resizing so the response comes back as resized WebP, which Godot can decode reliably without browser-dependent AVIF negotiation.

The avatar is delivered at one of these sizes: 64x64, 128x128, 256x256, 512x512, or 1000x1000 pixels. Request the smallest size that fits your UI for the best performance.

const AVATAR_REQUEST_HEADERS: PackedStringArray = [
"Accept: image/webp,image/png,image/jpeg,*/*",
]

func load_player_avatar(target: TextureRect) -> void:
var profile: JestPlayerProfile = JestSDK.social.get_profile(128)
if profile == null or profile.avatar_url.is_empty():
return # guest or no avatar set
var url: String = profile.avatar_url

var http := HTTPRequest.new()
add_child(http)
http.request_completed.connect(
func(_r, code, _h, body):
http.queue_free()
if code < 200 or code >= 300: return
var image := Image.new()
if image.load_webp_from_buffer(body) != OK \
and image.load_png_from_buffer(body) != OK \
and image.load_jpg_from_buffer(body) != OK:
return
target.texture = ImageTexture.create_from_image(image)
)
http.request(url, AVATAR_REQUEST_HEADERS)

When loading the URL with HTTPRequest in a web export, send an image Accept header as shown above. This keeps the CDN response on the WebP variant with CORS headers.

get_profile() returns null for guest players and registered players who haven't set up a profile. avatar_url may be an empty string for registered players with no avatar set. Always provide fallbacks in your UI.

JestSDK.social.get_profile()​

JestSDK.social.get_profile(avatar_size: int = 1000) -> JestPlayerProfile

Parameters:

NameTypeDescription
avatar_sizeintOptional. One of 64, 128, 256, 512, or 1000. Defaults to 1000. Other values bucket down to the next supported size.

Returns a JestPlayerProfile instance, or null when the player has no profile:

PropertyTypeDescription
usernameStringThe current player's username, or an empty string when the player has no username.
avatar_urlStringA Cloudflare-proxied WebP avatar URL, or an empty string when the player has no avatar.

Bots​

When games need to fill in player slots with bots, we recommend using the bot avatars for this purpose. There are 1000 unique bot avatars, and you can request them using the JestSDK.social.get_bot_avatar method. They are generated deterministically, so the same username will always return the same avatar.

The avatar is delivered at one of these sizes: 64x64, 128x128, 256x256, 512x512, or 1000x1000 pixels. It is recommended to request the smallest size that fits your UI for best performance, as this will minimize network traffic and improve loading times.

func get_bots(usernames: Array) -> Array:
var bots: Array = []
for username in usernames:
bots.append({
"username": username,
"avatar_url": JestSDK.social.get_bot_avatar(username, 128),
})
return bots

get_bots(["Hello", "Jest", "Bots"])
512x512256x256128x12864x64

JestSDK.social.get_bot_avatar()​

JestSDK.social.get_bot_avatar(username: String, size: int = 1000) -> String

Parameters:

NameTypeDescription
usernameStringRequired. Used as a seed for the avatar — the same username always returns the same avatar.
sizeintOptional. One of 64, 128, 256, 512, or 1000. Defaults to 1000. Other values bucket down to the next supported size.

Returns:

TypeDescription
StringThe URL of the bot avatar.

The mapping from username to avatar is deterministic and identical across game engines, so the same username yields the same avatar whether your game uses the Godot, Unity, or HTML5 SDK.

Sharing images​

JestSDK.social.share_image() opens the platform's share sheet for an image — the same sheet the platform's own screenshot button shows, offering chat, the native share sheet and download. Use it behind your own button: a "share my build", "brag about this score" or "send a coupon" action.

var social = JestSDK.social

var image := JestUtils.texture_to_data_url(coupon_texture)
var result: JestShareResult = await social.share_image(image, {"coupon": "SPRING25"})
if result.ok and not result.canceled:
on_image_shared()

The player picks where it goes and writes the caption themselves, so your game never shares on their behalf without a tap. Every call opens the same sheet the footer's screenshot button shows:

var result: JestShareResult = await social.share_image()
if result.ok and not result.canceled:
on_image_shared()

Omit image and the platform captures your game's canvas, the same way the platform's own screenshot button does.

When you pass an entry_payload, the platform appends a link to your game to the posted message. Opening that link launches your game with the payload in the entry payload, so a code or coupon travels with the share and is redeemable from chat.

canceled is false only when the image was posted to chat. A share to another app, a download, or a dismissed sheet all report canceled: true. A failed post is reported to the player in the sheet; result.ok is false when the call could not run at all — a rejected image, a capture that failed before the sheet opened, or a bridge timeout.

canceled: true is not proof that nothing was posted: a player who leaves the page while a post is still landing is reported as cancelled even though the message arrives. Re-sharing on canceled can duplicate the message.

JestSDK.social.share_image()​

JestSDK.social.share_image(image: String = "", entry_payload: Dictionary = {}) -> JestShareResult

Parameters:

NameTypeDescription
imageStringOptional. Base64 PNG, JPEG, WebP or GIF data URL, at most 2 MB. Omit it to let the platform capture your game's canvas.
entry_payloadDictionaryOptional. Handed back to your game when a player opens the shared message. The platform appends a link carrying it to the post.

Returns a JestShareResult:

PropertyTypeDescription
okboolfalse when the call could not run: a rejected image, a failed capture, or a timeout. error holds the reason.
canceledbooltrue when no post to Jest chat was confirmed: a dismissed sheet, but also a share to another app or a download. See the caveat above.
errorStringHuman-readable error message. Empty when ok is true.

Use JestUtils.texture_to_data_url(texture) (or JestUtils.image_to_data_url(image)) to build a data URL from a Texture2D or Image. They decompress the source first when needed, so compressed textures encode correctly — Image.save_png_to_buffer() requires an uncompressed format.