logo

How to Send Segmented Notification through API

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″],
  “gcmApiKey”: “AAAAi1LqmMM:APA91bGS7cHPMOIfsdfghjkl;sdfghjkl;sdfghjkl;’wertyuiop[234567890-=fghjkl;’dfghjkl;’z1uZWIAiZLiMe3qkvIk5uWpTwSgpO_V6u85lY2Pwz_cK0uUmwrko7cvBQ7_AgVJ7″,
“VAPIDDetails”:{
        “publicKey”:”BGHTk1hKgNVrXGyu3iXTyEXduVvLDRzGzd-aa6MPBGE7-HKsRsU2Dd17ojDK9pBS_                         WtOmkaz0FIu-KPhB2yYMzg”,
         “privateKey”:”9ddfj3MWc7t-zWtnr46tP9tXJC8w5604PmT-g1V-VE4″
},
  “campiagnId” : “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, gcmApiKey, propertyId,  VAPIDDetails {“publicKey”: ,”privateKey”: } can be found on settings page of app.connecto.io.
  • campiagnId: campiagnId 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 true
    segmentIds :[“string”],
    segment : {}
    Different Attribute according to type of notification:
    type:1 (plain Text)
    message:String,
    targetUrl:  String,
    icon: String,
    badge: String
    type:3 (Text with one Action Button)
    message:String,
    targetUrl:  String,
    icon: String,
    badge: String,
    actionButtonText1: String,
    targetUrl1:  String,
    imageUrl1: String
    type: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: String
    type: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: campiagnId is mandatory field in this payload. please use campiagnId so that we can maintain impressions on this notification.
  • Share

Leave a reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>