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
});
- 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"
};