Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Devices Collection

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.

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

Devices Collection

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...

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Devices Collection

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.

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

Devices Collection

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

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Devices Collection

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.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Devices Collection

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?

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

Devices Collection

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...

Return to “Issues”