As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
How to send a push notification to members in a specific team (group)??
J
John Moon
started a topic
over 9 years ago
Dear advanced Kinvey users and developers,
I'm novice to Node.js and MongoDB. I'm stuck to send a push notification to users in a specific group (not other groups).
For example, there are several marathon teams. (Let's say 5 teams).. The average time of a user 1 in a team 1 just updated in the server. What I want to do is to send push notifications to only the same team members (in team 1), not members in other teams...
Although I tried to follow the links below, I do not know how to access only the specific team members...
What does your data model look like? How are you defining groups in relation to users? The correct way to do this would be to get the group for the user, then use the collectionAccess module to query all users associated with the same group and send them push notifications.
J
John Moon
said
over 9 years ago
Hi Michael Salinger,
Thanks very much for your feedback. I really appreciate.
Here are the data model of my collections.
What I want to do is that...Once a team member (user10) finished running, the members in the same team will be notified. In this structure, when any of the values in the 'RunResult' collection changes, members in the 'RunningTeamA' will be notified.
RunResult
{
_id: '43878217492...42013948',
runner: {
_id: '019324029...190827428',
name: 'user10'
},
avgSpeed: {
date: '2013-1023',
value: '5.3'
},
maxSpeed: {
date: '2013-1023',
value: '8.3'
},
totalDistance: {
date: '2013-1023',
value: '14.3'
}
}
RunningTeamA
{
_id: '2314723897491230412384',
teamName: "teamName1",
members: {
{
_id: '019324029...190827428',
username: 'user1',
},
{
_id: '019324029...190827428',
username: 'user2',
},
...
{
_id: '019324029...190827428',
username: 'user10',
}
},
location: 'Chicago, IL'
}
Please give me any advise (which will be really helpful to me), and let me know if you need more details.
Thanks in advance,
John Moon.
M
Michael
said
over 9 years ago
Assuming the _id for each member in the group matches the user collection's _id field for each user:
First, you need to retrieve all of the _id values of the users in RunningTeamA that you want to send push notifications to. Then, query the user collection for those IDs to obtain the user documents. Finally, pass that array of user documents to the push module in order to send the push notifications.
John Moon
I'm novice to Node.js and MongoDB. I'm stuck to send a push notification to users in a specific group (not other groups).
For example, there are several marathon teams. (Let's say 5 teams).. The average time of a user 1 in a team 1 just updated in the server. What I want to do is to send push notifications to only the same team members (in team 1), not members in other teams...
Although I tried to follow the links below, I do not know how to access only the specific team members...
http://devcenter.kinvey.com/rest/guides/business-logic#invoking-endpoint
http://devcenter.kinvey.com/rest/guides/business-logic#Triggeringpushnotifications
Could you please tell me how to modify?
Please help me to resolve this issue.
Thanks very much in advance,