Advance Settings

indigitall SDK for Segments clicking here

Segments / 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.

final _indigitallInappFlutterPlugin = IndigitallInappFlutterPlugin();

// Call the method
_indigitallInappFlutterPlugin.inAppTopicList(
  params,
  (topics) {
    // This block is executed when topics are successfully retrieved
    print("Topics from console:");
    for (var topic in topics) {
      print("- $topic");
    }
  },
  (error) {
    // This block is executed when an error occurs
    print("Error ${error.code}: ${error.message}");
  },
);

List groups from console

This method can be customized with the following options:

  • Config (InAppConfiguration): Configuration object.
    • appKey (string, required): Application key.
    • urlInAppApi (string, optional): Custom InApp API URL. Only required if you work with a custom cloud environment.
  • limit: Defines the number of topics that will be returned on each page. The minimum allowed value is 20.
  • page: number of the page

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.

final _indigitallInappFlutterPlugin = IndigitallInappFlutterPlugin();

// Define the parameters
final params = {
  "appKey": "YOUR_APP_KEY",                   // Required: your application key
  "domainInApp": "YOUR_CUSTOM_DOMAIN", // Optional: only if you use a custom API domain
  "limit": 20,  // Minimum value is 20
  "page": 0     // Starting page
};

// Call the method
_indigitallInappFlutterPlugin.inAppTopicListFromConsole(
  params,
  (topics) {
    // This block is executed when topics are successfully retrieved
    print("Topics from console:");
    for (var topic in topics) {
      print("- $topic");
    }
  },
  (error) {
    // This block is executed when an error occurs
    print("Error ${error.code}: ${error.message}");
  },
);

When the request is successful, the onSuccess callback provides an INInAppPageTopic object.

  • Fields
    • topics (ArrayList?): List of topics included in the current page.

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.

final _indigitallInappFlutterPlugin = IndigitallInappFlutterPlugin();

// List of topics to subscribe
final topicsToSubscribe = ["sports", "news", "offers"];

// Call the method
_indigitallInappFlutterPlugin.inAppTopicSubscribe(
  topicsToSubscribe,
  (topics) {
    // This block is executed when topics are successfully subscribed
    print("Successfully subscribed to topics:");
    for (var topic in topics) {
      print("- $topic");
    }
  },
  (error) {
    // This block is executed when an error occurs
    print("Error ${error.code}: ${error.message}");
  },
);


// Call the method
_indigitallInappFlutterPlugin.inAppTopicUnsubscribe(
  topicsToUnsubscribe,
  (topics) {
    // This block is executed when topics are successfully unsubscribed
    print("Successfully unsubscribed from topics. Remaining subscriptions:");
    for (var topic in topics) {
      print("- $topic");
    }
  },
  (error) {
    // This block is executed when an error occurs
    print("Error ${error.code}: ${error.message}");
  },
);