Optional
dataReadonly
idOptional
jwtOptional
profileOptional
profileOptional
userVerify user has valid interactive credentials
await user.checkInteractiveCredentials();
Close an iframe for a visitor currently in a world.
await visitor.closeIframe("droppedAssetId");
Optional
error?: unknownOptional
message?: stringOptional
params?: objectOptional
sdkRetrieves all worlds a user with matching API Key is an admin in, creates a new World object for each, and creates new map of Worlds accessible via user.adminWorlds.
await user.fetchAdminWorldsByKey();
const adminWorlds = user.adminWorlds;
Returns all assets owned by User when an email address is provided.
await user.fetchAssets();
const userAssets = user.assets;
Retrieves the data object for a visitor.
const dataObject = await visitor.fetchDataObject();
Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
const interactiveWorlds = user.interactiveWorlds;
Returns all platform assets.
const assets = await user.fetchPlatformAssets();
Returns all scenes owned by User.
await user.fetchScenes();
const userScenes = user.scenes;
Get a single visitor from a world
await visitor.fetchVisitor();
Returns details for a visitor in a world by id and urlSlug
Retrieves all worlds owned by user with matching API Key, creates a new World object for each, and creates new map of Worlds accessible via user.worlds.
await user.fetchWorldsByKey();
const userWorlds = user.worlds;
{ urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
Display a message via a toast to a visitor currently in a world.
await visitor.fireToast({
groupId: "custom-message",
title: "Hello World",
text: "Thank you for participating!",
});
Get all particles available
await visitor.getAllParticles();
Grant expression to a visitor by id or name.
await visitor.grantExpression({ name: "Eyes" });
Optional
id?: stringOptional
name?: stringIncrements a specific value in the data object for a visitor by the amount specified. Must have valid interactive credentials from a visitor in the world.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await visitor.incrementDataObjectValue(
"path": "key",
"amount": 1,
);
Optional
analytics?: string[]Optional
lock?: { Optional
releaseTeleport or walk a visitor currently in a world to a single set of coordinates.
await visitor.moveVisitor({
shouldTeleportVisitor: true,
x: 100,
y: 100,
});
Updates each Visitor instance and world.visitors map.
Open an iframe in a drawer or modal for a visitor currently in a world.
await visitor.openIframe({
droppedAssetId: "droppedAssetId",
link: "https://topia.io",
shouldOpenInDrawer: true,
title: "Hello World",
});
Reload an iframe for a visitor currently in a world.
await visitor.reloadIframe("droppedAssetId");
Sets the data object for a visitor.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await visitor.setDataObject({
"exampleKey": "exampleValue",
});
Optional
analytics?: string[]Optional
lock?: { Optional
releaseTrigger a particle effect on a visitor
await visitor.triggerParticle({ name: "Flame" });
Optional
duration?: numberOptional
id?: stringOptional
name?: stringMute and turn video off for a visitor currently in a world.
await visitor.turnAVOff();
Updates the data object for a visitor.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await visitor.updateDataObject({
"exampleKey": "exampleValue",
});
Optional
analytics?: string[]Optional
lock?: { Optional
release
Summary
Create an instance of Visitor class with a given id and optional attributes and session credentials.
Usage