Page 1 of 1

Devices Collection

Posted: Thu Aug 13, 2015 4:47 pm
by Mike6979865

I'm writing server code to query all the zip codes for certain users, invoke a REST API to get the weather for these zip codes, and send push notifications to users daily of the weather forecast. The problem is the devices collection and users collections are separate. How can do I send a push to these users with certain zip codes? Please assist.


Devices Collection

Posted: Fri Aug 14, 2015 2:43 pm
by Serhii Kulibaba

Hello Mike,

You can unite devices and users collections:
add into devices collection column with data type=poiner, and set this pointer to users collection.
And use push filter for sending notifications to devices: https://devcenter.appery.io/documenta...


Devices Collection

Posted: Fri Aug 14, 2015 9:49 pm
by Mike6979865

I created a column in the devices collection with data type=pointer and I pointed it to the users collections. How will the _id be auto generated? It's not getting auto generated.


Devices Collection

Posted: Sat Aug 15, 2015 7:00 pm
by Serhii Kulibaba

You have to update device collection with database service: https://devcenter.appery.io/documenta...
http://prntscr.com/8502mc


Devices Collection

Posted: Mon Aug 17, 2015 8:53 pm
by Mike6979865

Thank you for this information. I'll update the device id and add a zip code for each device. Now, I want to write server code to go through all the zip codes, and invoke a weather based Rest Api, and based on the response send a Push Message to those users if it will rain. I'm just having trouble with that. Any references out there?

For example, if I have device id: 898798 and Zip Code: 92444, I want to run a weather rest api, and if the response is raining for example, I want to send a push message to that device. I want the server code to run every morning, and go through all the devices collection. Any help or reference would be appreciated.


Devices Collection

Posted: Wed Aug 19, 2015 7:01 pm
by Mike6979865

Any assistance would be appreciated.Here's what I want again:

  1. Zip Codes Will be Sent to REST API

  2. If the Response is Raining, I want to Send a Push to those Devices

    What's the best way to do that?


Devices Collection

Posted: Sun Aug 23, 2015 11:02 am
by Serhii Kulibaba

1) Please send query request with zip code: https://devcenter.appery.io/documenta...
2) Send push notification on the service's success event if data.length 0: https://devcenter.appery.io/tutorials...