Not possible to send Push messages with HTTP Post triggers o

Posted by bal on 26-Nov-2014 13:02

We have a private cloud and want to send push messages. Now we have configured https://api.mobile.rollbase.com/rest/push/msg as the Target URL.

We get the error: 

{"code":"PNMN004","description":"Push API Key: AIzaSyC-I3i813MdpDN1Hb9CEd6lWklOw not found"}

This key is correct, and we are able to send it manually from the MAB dashboard. Why couldnt we do this with the Rollbase triggers on private cloud?

All Replies

Posted by ajsharma on 28-Nov-2014 06:14

Hi Bal,

To send push notification from private cloud you have to use api.appdesigner.rollbase.com/.../msg as the Target instead api.mobile.rollbase.com/.../msg.

Please let me know if you need further clarification on the same.

Regards

Ajay Sharma

Posted by bal on 28-Nov-2014 07:51

Got it thanks!

Posted by bal on 30-Nov-2014 07:29

Another question: 

Im using the following request in the trigger:

<script>

{“filter”:{“type”:{“$in”:['I','A']}},
“payload”:{“message”:“Hetllo world”},
“status”:“sent”}

</script>

Im on a different timezone compared to the api.appdesigner.rollbase.com server. I want to send the push notifications immediately. How can i do that? I have also tried with the timezone parameters, but it looks like that the messages are scheduled and the system is not sending the push notifications. 

Posted by Peter Judge on 01-Dec-2014 08:07

Your payload should be sent immediately (the "status":"sent") should do it. If not, are there any messages in the push notification dashboard?
 
If you schedule the message, make sure you set the useDeviceTimeZone to "false" so that it gets sent to all devices at the given time.
 
-- peter
 
[collapse]
From: bal [mailto:bounce-bal@community.progress.com]
Sent: Sunday, 30 November, 2014 08:30
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] Not possible to send Push messages with HTTP Post triggers on Private Cloud
 
Reply by bal

Another question: 

Im using the following request in the trigger:

<script>

{“filter”:{“type”:{“$in”:['I','A']}},
“payload”:{“message”:“Hetllo world”},
“status”:“sent”}

</script>

Im on a different timezone compared to the api.appdesigner.rollbase.com server. I want to send the push notifications immediately. How can i do that? I have also tried with the timezone parameters, but it looks like that the messages are scheduled and the system is not sending the push notifications. 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by ajsharma on 01-Dec-2014 11:40

As Peter mention you need to have "status":"sent" and also you need to have "schedule":{"scheduledTime":0,"timeZone":0} mentioned it's required parameter. So when we mention "status":"sent" these parameters will be ignored and the Push Notification will be sent immediately.

Regards

Ajay

Posted by bal on 01-Dec-2014 16:44

Hi,
This is the message which I've sent:

<code>

{'filter':{'type':{'$in':['A,I']},"deviceID":'358588054208766;76a15e0589a75c1a'},'payload':{"badge":'1','message':'test'},"schedule":{"scheduledTime":0,"timeZone":0,"useDeviceTimeZone":"false"},'status':'sent'}

</code>

And the response is:

<code>

[{"_id":"547ce96ee4b035ef1c28d937","count":0,"dbId":"5476157ee4b0648e1ebfbd9d","errorMessages":{},"filter":"{ \"type\" : { \"$in\" : [ \"A,I\"]} , \"deviceID\" : \"358588054208766;76a15e0589a75c1a\"}","payload":{"badge":1,"message":"test"},"schedule":{"scheduledTime":"1970-01-01 00:00:00.000","scheduledTimeInTZ":"1970-01-01 00:00:00.000","timeZone":0,"useDeviceTimeZone":false},"status":"wait"}]

</code>

I've also changed the timezone etc, but I get the: "status":"wait" as response...I can see this record scheduled on the dashboard on date 1970-01-01 00:00

Any other idea's? 

Posted by ajsharma on 01-Dec-2014 22:16

Hi,

If you looking at the response it might be as "status":"wait". But if you see the status at Push Notification "Scheduled Push Notification" page the status is "Sent" & the date will be 1970-01-01 so you can ignore the date. So the push notification should get delivered to device without any issue if the status on this page is "Sent".

Please check on the device where you have the app installed. If it not working let us know.

Regards

Ajay

Posted by bal on 02-Dec-2014 05:41

Hi Ajay,

I have cheched the status, but also on the scheduled push notification screen i can see the status "wait". The messages have not been delivered yet....

Posted by Anil Kumar on 02-Dec-2014 05:51

Hi bal,
 
By any chance are you sending the push messages by keeping the mobile app in open state (in the device)? If yes, please follow below instructions such that the messages are sent properly to specific device from Push server.
 
Please add following event for the mobile app and send push notifications to the mobile app (in the mobile page where push messages are to be displayed)

alert(data.aps.alert)          

This will show appropriate push event/message as an alert message when the specific push message is sent keeping the mobile app in open state (in device).
 
If the app was closed in the device, then specific message should be delivered properly to the device.
 
Hope this helps.
 
Thanks and Regards,
Anil Kumar.
 
[collapse]
From: bal [mailto:bounce-bal@community.progress.com]
Sent: Tuesday, December 02, 2014 5:12 PM
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] Not possible to send Push messages with HTTP Post triggers on Private Cloud
 
Reply by bal

Hi Ajay,

I have cheched the status, but also on the scheduled push notification screen i can see the status "wait". The messages have not been delivered yet....

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by bal on 02-Dec-2014 17:08

Hi Anil,

Thanks for your reply. But the messages are still getting the "wait" status. Is the message above ok, which I've sent?

Is there also a need to register the device? Normally before, i haven't done that and was able to receive push notifications from the dashboard. But now when i try it again, the push from the dashboard is not send. and get the following status:

Description: NotRegistered

Devices count: 1

.

Posted by ajsharma on 02-Dec-2014 23:45

Hi Bal,

Yes you need to register the device into push database then only it will deliver the message. Normally this registration is automatic process. I would suggest you to check if your device is registered in Push Notification database. if not then please uninstall & install the app on device again & run the app so the device get registered.

Then you try to send the Push Notification I hope it should work without any issue.

Regards

Ajay

Posted by bal on 03-Dec-2014 04:37

Hi Ajay,

Thanks, i think the problem is there. I had some old records in the database, and now i have deleted them all. I have uninstalled the app and install it again, but the records are not created automatically. Am i missing something?

Posted by ajsharma on 03-Dec-2014 05:32

Hi Bal,

Few thing I would like to suggest to try:

1. Verify the Push Notification API Key which you using while making the REST Call should match to the APIKey mentioned at "MobileApp=>Push Notification=>Settings" Page on Dashboard.

2. There should be a record in Push Notification Database for that registered device. So to confirm that this record belongs to the same device where you expecting the Push Notification to get delivered. I would suggest you to delete the record & re-install the app & start the app on device & check there is new record created in database for that device.

3. I would suggest not to use "deviceID": filter in Push Notification Rest Call by this way you are sending the Push Notification to all registered devices in the database. So I would request you to try with following :

  {'filter':{'type':{'$in':['A,I']}},'payload':{"badge":'1','message':'test'},"schedule":{"scheduledTime":0,"timeZone":0,"useDeviceTimeZone":"false"},'status':'sent'}

4. Also as Anil Suggested earlier please keep your app in closed state.

This way you should get see the record created on Dashboard in "Scheduled Push Notification" page.

I would also like to request you to share Push API Key so we can try sending the Push Notification form our side to check if you can receive that way.

Regards

Ajay

Posted by ajsharma on 03-Dec-2014 05:58

Hi Bal,

I think I got the issue what is the issue. Its a minor mistake you did while typing the "type" filter as ['A,I'] this should be ['A','I']. each type should be enclosed in single quotes. :)

So please use the filter sting as below :

{'filter':{"type":{"$in":['I','A']}},

"payload": {"badge": 1, "message": "1"},

"status": "sent",

"schedule": {"scheduledTime": 0, "timeZone": 0}  

}

Now I think this should work without any issue.

Regards

Ajay

Posted by bal on 03-Dec-2014 06:20

Hi Ajay,

Thanks for all options. But the main issue is that after deleting the record and reinstalling the app again, the database-device id remains empty. Any idea? The problem is here, i think...

My API key is: bfb212c9-5a4c-43e9-8471-6fd44e56f28c

By the way: We need to send segmented push messages (to a few device-id's). You've suggested not to use this, why? Its a customer requirement, we need to build it in this way, hope that it will work...

Posted by bal on 03-Dec-2014 06:23

At the moment im testing the push messages with the dashboard. The post trigger will be step 2 :)

Posted by ajsharma on 03-Dec-2014 06:30

Hi Bal,

I suggested not to use device id just for time until we are able to send basic Push Notification. And about device id coming as empty is an issue because if device id is empty then the push will not be get delivered to device.

Can you please let us know which device you are using (Android, iOS).

Regards

Ajay

Posted by Peter Judge on 03-Dec-2014 08:05

>By the way: We need to send segmented push messages (to a few device-id's). You've suggested not to use this, why? Its a customer requirement, we need to >build it in this way, hope that it will work...

You can add your own filter fields to the device database in the dashboard. You would need to populate those values via the UpdateDevice API call. See the doc at http://docs.mobile.rollbase.com/documentation/backendservices/push/ for this and also for the Filtering section (which is how you'd send messages to only certain devices).

Hth,
-- peter

 
 
 
[collapse]
From: bal [mailto:bounce-bal@community.progress.com]
Sent: Wednesday, 03 December, 2014 07:21
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] Not possible to send Push messages with HTTP Post triggers on Private Cloud
 
Reply by bal

Hi Ajay,

Thanks for all options. But the main issue is that after deleting the record and reinstalling the app again, the database-device id remains empty. Any idea? The problem is here, i think...

My API key is: bfb212c9-5a4c-43e9-8471-6fd44e56f28c

By the way: We need to send segmented push messages (to a few device-id's). You've suggested not to use this, why? Its a customer requirement, we need to build it in this way, hope that it will work...

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by bal on 03-Dec-2014 10:35

Still having the issue. localStorage.getItem('pushNotificationDeviceID') remains empty. Very very weird...still investigating...

Posted by bal on 03-Dec-2014 14:28

Got it, it was due the bug which will be solved in 3.1...The cordova_plugins.js was corrupt...Now testing the trigger..

Posted by bal on 03-Dec-2014 14:39

Yes it works!!

@Ajay: it was idd a typo :)

This thread is closed