Retargeting
Your app can send information to indigitall's servers to identify the actions and events that happen in it. This allows you to automate retargeting actions.
To register these events you have to call the sendCustomEvent method, passing a descriptive ID as a parameter (you can invent the one you like best) and set data you need on JSON object.**
window.plugins.indigitall.sendCustomEvent({event: "YOUR_CUSTOM_EVENT", customData:{}, () => {
// Do something in success function
},(error) => {
// Do something in error function
});
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.
window.plugin.indigitall.topicsList((topics) => {
// Do something with topics in success function
}, (error) => {
// Do something in error function
});
- 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[]
window.plugin.indigitall.topicsSubscribe(topics, (topics) => {
// Do something with topics in success function
}, (error) => {
// Do something in error function
});
// topics is typeof String[]
window.plugin.indigitall.topicsUnsubscribe(topics, (topics) => {
// Do something with topics in success function
}, (error) => {
// Do something in error function
});
Collection of push data
If you want to get info of silent push, on Android you must to change on android manifest the following services:
<!-- change this code-->
<service android:name="com.indigitall.android.services.FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- with this code-->
<service android:name="com.indigitall.cordova.IndigitallCDVFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
In the event that a silent push is sent, or you want to collect the push data before it is pushed, you must add the following method, which will return a remoteMessage in json format.
window.plugins.indigitall.onMessageReceived(data => {
//do something
},(error)=>{
//log error
});
To differentiate if the push is from indigitall or not, you can use this method, passing data obtained in the previous method:
window.plugins.indigitall.isIndigitallPushNotification(data,()=>{
//do something
}, (error)=>{
//log error
});
If you want to collect the token, add the following method:
window.plugins.indigitall.getToken(token => {
//do something
},(error)=>{
//log error
});
In the event that you want to obtain the push object of type json to perform checks and / or when the user clicks on the notification and is with the action of open app. The device model would have this structure:
push = {
id: "int",
appKey: "string",
title: "string",
body: "string",
icon: "string",
image: "string",
gif: "string",
video: "string",
action: {
topics: ["string"],
destroy: "boolean",
type: "app | url | call | market | share",
app: "string",
url: "string",
call: "string",
market: "string",
share: "string"
}
buttons: [{
label:"string",
action: {
topics: ["string"],
destroy: "boolean",
type: "app | url | call | market | share",
app: "string",
url: "string",
call: "string",
market: "string",
share: "string"
}
}]
data: "string",
layout: "Layout",
securedData: "string"
};
We leave you this code that will help to obtain it:
@Deprecated
window.plugins.indigitall.getPush(push => {
//DO SOMETHING
},(error)=>{
// Do something in error function
});
window.plugins.indigitall.onIndigitallGetPush(push => {
//sucess
},(error)=>{
//error
});
Push Secure Received Event - iOS platform
On Android is implemented into native sdk, but on iOS you have to add code.
Only on API use of Push Secure Sending
If you want to receive an event that indicate if the push comes with sendEventAck flag and the encrypted pushes are active, add the following on AppDelegate on didReceived method:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Indigitall.didReceivePush(withNotification: userInfo) { push in
print("Push notification with push secure: \(push.pushId)")
}
}