Segmented notification can be send from app.connecto.io and through API.
Please follow the steps to send segmented notification through API.
API : http://app.connecto.io/send/chromePushNotificationApi
Example : You want to send Notification to target users : who have submitted lead with city_name equals jaipur or visited page ‘/’ having attribute model_name equals Honda in last 7days.
payload for Segmented Notification API.
{
“writekey”: “XXXXX”,
“projectId”: “abcdefghijklmnnopq”,
“propertyId” : ”1123456789123456″,
“campaignId” : “5b6c13d6a5486b438c81c57c”,
“notification”: {
“name”: “Notification_Name”,
“title”: “Notification title”,
“type”: 1,
“badge”: “”,
“message”: “planning to buy Car- 2018”,
“targetUrl”: “https://www.connecto.io/“,
“segment”:{
“windowStart” : 7,
“windowEnd” : 0,
“isActive” : true,
“computationMode” : “offline”,
“orRules” : [
{
“andRules” : [
{
“rule” : {
“eventText” : “Lead”,
“attributeKey” : [
“City”
],
“attributeValue” : [
“jaipur”
],
“attributeMatchType” : [
0
]
},
“hasDone” : true,
“type” : 0
}
]
},
{
“andRules” : [
{
“rule” : {
“urlMatchValue” : “/”,
“attributeKey” : [
“brand”
],
“attributeValue” : [
“Honda”
],
“attributeMatchType” : [
0
]
},
“hasDone” : true,
“type” : 1
}
]
}
]
}
}
}
- writekey, projectId, propertyId can be found on settings page of app.connecto.io.
- campaignId: campaignId is same as notificationId .
- Notification object contain some common attributes and some different attributes which get changed according to type of notification.
Common attributes:title: String,name: String,type : Number, // type can be (1/3/4/5) according to type different attribute is used.tag:String, // tag is mandatory filed which should contain ‘connecto’ as value.
require_interaction : String,
isScheduled: Boolean,schedule_time: “7/25/18 4:19 PM”, //only if isScheduled is truesegmentIds :[“string”],segment : {}Different Attribute according to type of notification:type:1 (plain Text)message:String,targetUrl: String,icon: String,badge: Stringtype:3 (Text with one Action Button)message:String,targetUrl: String,icon: String,badge: String,actionButtonText1: String,targetUrl1: String,imageUrl1: Stringtype:4 (Text with two Action Button)message:String,targetUrl: String,icon: String,badge: String,actionButtonText1: String,targetUrl1: String,imageUrl1: String,actionButtonText2: String,targetUrl2: String,imageUrl2: Stringtype:5 (Text with Banner)message:String,targetUrl: String,icon: String,badge: String - some details of keys inside Segemnt object:-
windowStart should be greater than windowEnd.orRules is an array of andRules objects.andRules is an array of objects , where each object contain rule , hasDone(where true means executed and false means not-Executed) and type(1 means page view and 0 means Event ).rule contains attributeMatchType having two values.(0 means equals and 1 means not equals ).segemntvariable is one object inside andRules.Precaution: please don’t make a segment variable which contain attributeMatchType 1 .,i.e(not equals). It should contain atleast one 0 (equals ) case.
Note: campaignId is mandatory field in this payload. please use campaignId so that we can maintain impressions on this notification.