Yahya
Posts: 0
Joined: Tue Nov 11, 2014 1:08 pm

push notification

Good day,

I am using the below function to send push notification to specific users some time it send the message to all registred devices, can you please check if something need to be changed in the below code.

function sendPushToChat(m){
var filter={"deviceID":{"$in":["355afb8268bbdfqr","EFG098-0F88-4AE5-A69A-761FA8620A7E"]},"type":{"$in":["I","A"]}};
var custData={"mydeviceID":Apperyio.storage.mydeviceID.get(),"hisdeviceID":Apperyio.storage.hisdeviceID.get(),"requestType":"chat"};

Code: Select all

 testPushService.execute({ 
             body: { 
                 "payload":{ 
                     "message":m, 
                     "badge":1, 
                     "title":"شات", 
                     "customData": custData 
                 }, 
                 "status":"sent", 
                 "filter": filter, 

             },  
             success: function(){ 
                     $('.sathaInfoPopup').popup('close'); 

             }, 

             error: function(){ 
                 toast('خطأ في ارسال الرسالة..!! '); 
             } 

         }); 

}

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

push notification

Hello,

You send incorrect data structure here. Please look at this topic how to send it: https://getsatisfaction.com/apperyio/...

If you need to filter devices for sending notifications - it is better to use Server Code script for that: https://docs.appery.io/v2.4.0/referen...

Return to “Issues”