Advanced Settings

Topics

Our SDK allows you to classify users into different customizable groups. This is very useful for:

  • Implement a preferences screen so that the user can choose the topics for which they want to receive notifications.
  • Label according to the navigation or actions that the user performs.
  • Segment communications according to whether the user has identified or is anonymous.
  • Segment based on language, culture, customer category, or based on any other criteria you need.

Remember that you must first define the groups you want to work with in the indigitall console (Tools>Topics).

List groups

Use the topicsList method to get the list of groups that are configured in your indigitall project. The callback of this method receives as a parameter an array of Topics, which contains the information of all the available groups, as well as a flag that indicates whether the user is included in any of them.

indigitall.InApp.topicList((topics) => {
    //DO SOMETHING
}, (error) => {
    //log error
});

List groups from console

This method can be customized with the following options:

  • urlInAppApi (optional): Use this parameter only if your project works with a custom cloud environment. If you are using the default Indigitall cloud, this value is not required.
  • appKey (optional): If the application key has not been defined in another method, you must provide it here.
  • limit: Defines the number of topics that will be returned on each page. The minimum allowed value is 20.

When calling the method, you will receive the topics in a paginated format. This means you can check the current page, view the available topics, and continue loading additional pages until there are no more results.

In case of error, the method provides an error callback so you can handle the issue appropriately.

indigitall.InApp.topicsListFromConsole(
  {
    appKey: AppKey,
    urlInAppApi: ENVIRONMENT_INAPP_API,
    limit: 20 // Minimum value is 20
  },
  (inAppPaged) => {
    console.log(`Topics page ${inAppPaged.currentPage}:`, inAppPaged.topics);
    if (inAppPaged.hasNextPage()) {
      inAppPaged.loadNextPage();
    } else {
      console.log("No more InApp topics available");
    }
  },
  (err) => {
    console.error("Error topicsListFromConsole:", err);
  }
);

The method returns an object of type InAppPageTopics, which includes the following fields:

  • topics (array): List of topics included in the current page.
  • currentPage (number): Indicates the page number being returned. If not specified, it starts at 0.
  • totalElements (number): Total number of topics available across all pages.
  • limit (number): Maximum number of topics per page. If not explicitly defined, the default value is 20.
  • totalPages (number): Total number of pages available, calculated as totalElements / limit.

Manage subscription

To manage the device subscription to one or more groups, there are two methods: topicsSubscribe and topicsUnsubscribe.

Optionally, both receive a TopicsCallback object as the third parameter, which will return the list of all Topic in the project.

//topics is typeof string[]
indigitall.InApp.topicsSubscribe([topicsCodes], (topics) => {
    //DO SOMETHING
}, (error) => {
    //log error
});
  
  //topics is typeof string[]
  indigitall.InApp.topicsUnsubscribe([topicsCodes], (topics) => {
    //DO SOMETHING
}, (error) => {
    //log error
});

LogIn and logOut

Once you have to initialize the SDK of Indigitall, it generates our identifier (deviceId) and be able to associate it with the custom ID that you associate to the device.

To perform the registration tasks, these two methods are used:

//User ID
indigitall.InApp.logIn("YOUR_ID", (hash)=>{
     //DO SOMETHING
}, (error)=>{
    //LOG ERROR
});

//Disconnection
indigitall.InApp.logOut(()=>{
    //DO SOMETHING
}, (error)=>{
    //LOG ERROR
});

Profile

You can set the profile variable when displaying an InApp. This allows you to add an additional type of filter — for example, if you want to control the display of the InApp for different users within the same campaign, without needing to create multiple ones with the same schema code.

const config = {
    appKey: "YOUR APP_KEY",//if not push on project
    urlInAppApi: “https://{{cloud}}.device-api.indigitall.com/v2”,
    logLevel: indigitall.LogLevel.DEBUG,
    inAppCode: "YOUR_INAPP_CODE",
	  viewId: viewId,
		profile: "YOUR_PROFILE"

};