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.
Are you running into a specific problem with the API or just want to make a suggestion of an improvement?
If you're running into a specific issue. Can you please articulate the specific problem you're running into and what you expect to have happen instead?
M
Michael
said
over 9 years ago
Gary,
You can use either a single user document, or an array of user documents. It doesn't matter if it's a single entity such as what is returned with findOne, or an array such as is returned by find.
So suppose you have a variable `userEntity` that contains the following:
```
{_id:"1234", _push: { ... push data ... }, username: "johndoe"}
```
Then you can call
```
push.sendMessage(user, "Hello");
```
That will send a push notification to the user that is contained in the userEntity variable.
You could also have userColl, which is an array of users, such as
would send a message "Hello" to all users contained in sendMessage.
Note that the message in sendMessage is static and doesn't allow for tokenization at the current time. You can, however, use the forEach example (although we'd recommend using async.each instead) to iterate through and send a different message to each recipient.
Gary W
The reason I am asking is I'm wondering why if it says: ... users is either an array of Kinvey User documents or a single user document.
Why can't the call be this: push.sendMessage(userColl, request.body.message);
Rather than like this, as shown in your sample (slightly modified):
userColl.forEach(function (user) {
push.sendMessage(user, request.body.message);
});
From this page: http://devcenter.kinvey.com/rest/reference/business-logic/reference.html#push-module
And I want to better understand what's going on.