helper methods

The UI Apps software development kit exposes the following methods allowing us to interact easily with the current Gtmhub context(account, user, objective or key result) your app is running in.

NOTE: Before you start using the SDK methods, ensure you have imported and configured the SDK first.

getCurrentUser

To get the data about the current Gtmhub user interacting with your UI App, use the getCurrentUser method. For example:

sdk
  .getCurrentUser(settingId)
  .then((currentUser) => console.log(currentUser));

getAccountId

To get the Id of the Gtmhub accout your Ui App is currently running in, use the getAccountId method. For example:

sdk
  .getAccountId()
  .then((accountId) => console.log(accountId));

getCurrentItem

Your UI App can run either in the context of a Gtmhub Objective or Key Result. To get the Id of the current Gtmhub item the Ui app is loaded for, use the getCurrentItem method. For example:

sdk
  .getCurrentItem()
  .then((item) => console.log(`Current item is, ${item}`))

getAccountUrl

To get the vanity domain of the currently logged user.

sdk.getAccountUrl().then((response) => {
  console.log(response);
});

getAccountSettings

To get account settings for the currently logged user.

sdk.getAccountSettings().then((response) => {
  console.log(response);
});