Skip to main content
ImportantBefore you can use any other functions of the SDK, you must initialize it by calling the initialize() method.

Initialization

initialize

The initialize() method initializes the SDK with the given token and domain. Additionally, you need to pass an options argument and tell whether you want to use the SDK in game or widget mode. If you are running the SDK in-game, use the game mode and if you are running it on your website, use the widget mode. InitializeGameOptions InitializeWidgetOptions

Opening and closing

openSupport

The openSupport() method opens the help center. TheymesConfig can optionally be used to customize the help center. See Configuring the SDK for more information.

openResource

Opens a specific resource from Theymes. This can be an article such as a game guide or patch notes, or a collector to gather feedback or bug reports from players. The player is returned to the game after interacting with the resource. You can get the value for resource argument from Theymes application, for example openResource("crafting-guide"). TheymesConfig can optionally be used to customize the resource. See Configuring the SDK for more information.

openAssistant

Opens the assistant view without other features of the help center. TheymesConfig can optionally be used to customize the resource. See Configuring the SDK for more information.

close

Can be used to close the help center or any other resource that is opened with openResource(). Normally you don’t need to call this method, as the player will see a close button in the SDK UI, but if you need to close the resource programmatically, you can use this method.

Notifications

Notifications can be shown to user when there’s a new message in their open tickets. Typically you would call enableNotifications() when transitioning to game menus or other screens where the player is not actively playing, and disableNotifications() when transitioning to gameplay.Notifications are disabled by default and widget mode does not support notifications.

enableNotifications

Enables in-game notifications to be shown to the player.

disableNotifications

Disables in-game notifications to be shown to the player.

Config

getLanguage

Returns the currently set language, or null if no language is set.

setLanguage

Sets the language in which the help center will be displayed.

getPlayer

Returns the currently set player information, or null if no player information is set. See Configuring the SDK for more information about the TheymesPlayer object.

setPlayer

Sets the player information. See Configuring the SDK for more information.

getSignedMetadataToken

Returns the currently set signed metadata token. See Player Verification for more information.

setSignedMetadataToken

Sets the player information. See Configuring the SDK for more information.

Tags

Tags can be used to send additional information to Theymes. The tag must be configured in the Theymes application first or otherwise it will be ignored.

getTags

Returns the currently set tags.

setTags

Overwrites the currently set tags with the new list of tags.

addTag

Appends a new tag to the currently set tags.

addTags

Appends new tags to the currently set tags.

removeTag

Removes a tag from the currently set tags.

removeTags

Removes tags from the currently set tags.

removeAllTags

Removes all currently set tags. Breadcrumbs are short diagnostic messages that are timestamped automatically and sent when opening support or a resource. They are kept in memory only and are cleared by clearBreadcrumbs() and reset().

addBreadcrumb

Appends a breadcrumb to the current breadcrumb list.

addBreadcrumbs

Appends multiple breadcrumbs to the current breadcrumb list.

clearBreadcrumbs

Removes all currently set breadcrumbs.

Fields

Fields are a set of key-value pairs that can be used to send additional information to Theymes. The field must be configured in the Theymes application first or otherwise it will be ignored. The value type for the fields is object, but accepted values are booleans, strings, numbers and lists of strings. The type must match the type configured in Theymes or it will be ignored.

getFields

Returns the currently set fields.

setFields

Overwrites the currently set fields with the new list of fields.

addField

Appends a new field to the currently set fields.

addFields

Appends new fields to the currently set fields.

removeField

Removes a field from the currently set fields.

removeFields

Removes fields from the currently set fields.

removeAllFields

Removes all currently set fields.

Privacy

isYoungPlayer

Returns true if the player is set as a young player, otherwise false.

setYoungPlayer

Sets whether the player is a young player.
Setting the player as a young player will also enable the privacy mode, you do not need to call setPrivacyMode(true) separately. Additionally support agents will see that they are talking to a young player and can handle the conversation accordingly.

isPrivacyMode

Returns true if the privacy mode is enabled, otherwise false.

setPrivacyMode

Sets whether the privacy mode is enabled.

Other

Returns true if the help center is supported on the current platform, otherwise false.

getSdkVersion

Returns the version of the SDK.

reset

Resets the SDK to its initial state. This can be useful if you have a logout flow and you want to clear all the player, fields, tags and breadcrumbs state.

getUnreadMessageCount

Returns the number of unread messages. You can use this to show a badge or indicator in your UI.

getUnansweredMessageCount

Returns the number of unanswered messages. You can use this to show a badge or indicator in your UI.

iosSetKeyboardHeight

Signal Theymes SDK that iOS keyboard is now visible or hidden with the given height (0 for hidden). Theymes SDK will re-layout its view if present to make sure that the keyboard is not blocking any text inputs users are writing to.
You generally never need to use this. This is only needed in special situations when embedding Theymes SDK inside an app wrapper such as Cordova and if you are overriding the default behavior of iOS keyboard to allow hiding your web page content under the keyboard.

Events

There are five different events Theymes currently supports. You can add and remove event listeners by calling addEventListener and removeEventListener with a listener function for each event type. You can use the events to update your game’s or web page’s UI (e.g. to show a badge or indicator for unread or unanswered messages).

addEventListener

Adds a listener for an event type. The signedMetadataTokenExpirationUpdate event is called only when a signed metadata token is set. It is called immediately when the page comes to the foreground and then once a minute while the page stays in the foreground. The listener receives the remaining expiration time in seconds. If the token is already expired, the value is 0 or negative. Your game or page decides when to refresh the token based on this value. The value is calculated from the client’s clock, so if the clock is not in sync, the reported expiration time is skewed too.

removeEventListener

Removes an attached listener. Note, the callback you pass to removeEventListener must be the same function reference which was passed to addEventListener.