Skip to main content
All SDK methods are static and are called on the Theymes class.
ImportantBefore you can use any other functions of the SDK, you must initialize it. See Installing the SDK for more information.

Initialization

initialize

Initializes the SDK with the given token and domain. You can optionally pass an options dictionary to override the SDK API domain.
Options (optional) — when passing the third parameter:

Opening and closing

openSupport

Opens the help center. Optionally pass a config dictionary to customize it. See Configuring the SDK for more information.

openResource

Opens a specific resource from Theymes (e.g. an article or collector). You can get the resource identifier from the Theymes application.

close

Closes the help center or resource that was opened with openSupport or openResource. Normally the user sees a close button; use this to close programmatically.

Notifications

Notifications can be shown when there’s a new message in the user’s open tickets. Typically you would call enableNotifications() when transitioning to menus or other screens, and disableNotifications() when transitioning to gameplay. Notifications are disabled by default.

requestNotificationPermission

Requests permission to show notifications. Call as part of your app initialization flow.

enableNotifications

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

disableNotifications

Disables in-game notifications.

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.

registerPushToken

Registers a device push token with Theymes. Use PushTokenType.apns for Apple Push Notification service or PushTokenType.fcm for Firebase Cloud Messaging. See Push notifications for more information. You can pass either a string (e.g. FCM token) or the raw device token data from didRegisterForRemoteNotificationsWithDeviceToken (APNs); the SDK converts the latter to the expected string format internally.

handlePendingNotificationAction

Handles a pending notification action when the user tapped a push notification while the app was in the background. Call this when your app becomes active (e.g. in applicationDidBecomeActive). See Push notifications for more information.

hasPendingNotificationAction

Returns whether there is a pending notification action to handle.

Config

getLanguage / setLanguage

Get or set the language in which the help center will be displayed.

getPlayer / setPlayer

Get or set the player information. See Configuring the SDK for more information.

getSignedMetadataToken / setSignedMetadataToken

Get or set the signed metadata token for Player Verification.

Tags

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

getTags / setTags

addTag / addTags

removeTag / removeTags / removeAllTags

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 / addBreadcrumbs

clearBreadcrumbs

Fields

Fields are key-value pairs that can be used to send additional information to Theymes. Values can be booleans, strings, numbers, or arrays of strings. The field must be configured in the Theymes application first or it will be ignored.

getFields / setFields

addField / addFields

removeField / removeFields / removeAllFields

Privacy

isYoungPlayer / setYoungPlayer

Setting the player as a young player also enables privacy mode and lets support agents know they are talking to a young player.

isPrivacyMode / setPrivacyMode

Other

isSupported

Returns whether the help center is supported on the current device (iOS 14+).

getSdkVersion

Returns the version of the SDK.

reset

Resets the SDK to its initial state (clears player, fields, tags and breadcrumbs). Useful for logout flows.

enableLogging / disableLogging

Events (Delegate)

iOS uses a delegate instead of events. Set Theymes.delegate to an object that conforms to TheymesDelegate. All delegate methods are optional. Callbacks are invoked on the main thread.
didUpdateSignedMetadataTokenExpiration(_:) is called only when a signed metadata token is set. It is called immediately when the app comes to the foreground and then once a minute while the app stays in the foreground. The delegate method receives the remaining expiration time in seconds. If the token is already expired, the value is 0 or negative. Your game 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.