-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send push notification from cloud code #401
Comments
Yes, but you must set the useMasterKey option to true.
|
Thanks, would this be the correct way to put it? :
|
It would be like this:
Or, since you're just sending to a channel:
I like promises syntax instead:
|
Spend hours trying to figure this out. Was missing Thank you! |
Thanks, but I still have issues. After updating my code to use the masterKey, i get the error "Cannot use the Master Key, it has not been provided." in the heroku logs. Then I set this in the top of my main.js: Then I got the error "You need to call Parse.initialize before using Parse." in the heroku logs. After setting this in the top of my main.js:
The heroku log says: "##### PUSH ERROR: Push adapter is not availabe". |
During initialization of the ParseServer instance, we set the global Parse object and initialize it with the master key. Are you overwriting the Parse global anywhere by requiring it again? |
No, I can`t see anywhere I do that. I use the parse-server-example out of the box, deployed with the Heroku-button on the GitHub page. |
@gfosco @oyvindvol I'm not sure the parse-server-example has been updated to install the latest parse-server 2.0.8.x and the new update to node.js 4.3 due to a security issue in 4.1 .. someone should update that so people are pulling the latest 2.0.8 to avoid potential bugs being reported from a older version.. ?? |
Is there a way to useMasterKey in Android when sending push notifications using ParsePush like : |
I've tried the above syntax but I'm getting an unauthorized error logged. I've tried changing the query to channels:["user"] just to make sure that the issue was not from querying users, but still no luck. Any ideas?
|
Here is a blog post on how to setup push notifications server-side and and Android app. It took me so long to figure it how, hope it helps. http://www.tuogol.com/parse-server-android-push-notifications/ |
I tried the blog post from Matthew, but the ParseCloud.callFunctionInBackground errors out with Invalid function |
@mankan1 Is your server running? and does your main.js have the sendAnnouncement function? |
Server is running but does not implement sendAnnouncement function. That explains it. so do i need to implement sendAnnouncement that sends notification to all the devices. How about if I want to send it a only a few device based on a query. How do I implement sendAnnouncement to send a notification to these devices. I know that server needs to send a message to the Google cloud and GCM will take care of sending the notification by using the sender_id. Is this all that needs to be implemented ? or is there something already there in the parse server example. Thanks a lot. |
@mankan1 So it'll send it to a channel, which is defined as a group of people (or person) who have subscribed to said particular. I'll modify the article to reflect that information. So you'll want/need to subscribe the user to the channel your going to test with. |
The problem again is that you have to set serverURL in your index.js for Cloud Code to work. The only way to tell is by using node-inspector and connecting it up to Chrome to see that your API calls are being made to api.parse.com. I got cloud push working once this happened. |
mankan1 |
@gfosco Iam facing the same issue. I followed above comments still same issue. My cloud clode: |
@maruthi-wal What error do you get? |
I also have issue: "code":115,"error":"Push adapter is not availabe" var api = new ParseServer({ push: { curl -X POST I tryed the same with server https://api.parse.com/1/push end everything work perfect. |
Could it be because the serverUrl is not specified ? |
There's too many different things going on here. The original issue question has been answered. Individually, if you can try with the latest code, and open new issues with details or investigations, I'll do my best to help you. Be sure to follow the push wiki https://github.com/ParsePlatform/parse-server/wiki/Push and set serverURL when initializing ParseServer. |
Hey Guys! I am trying this approach to send push notifications. The notifications is delivered successfully but the problem is how to use the 'content-available' flag. i'm trying this with no success:
Anyone here using the content-available? where should i put it? Thank you! |
Did you ever get the 'content-available' flag figured out? |
Definitely, check my answer here: https://stackoverflow.com/questions/42895648/sending-push-notifications-with-parse-server-cloud-code-using-content-available/42895733#42895733 <https://stackoverflow.com/questions/42895648/sending-push-notifications-with-parse-server-cloud-code-using-content-available/42895733#42895733>
… On Oct 11, 2017, at 8:17 PM, bmueller ***@***.***> wrote:
Did you ever get the 'content-available' flag figured out?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#401 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AIN9nUQTFkNME9f-vH_phKiwwInqfzcEks5srYTGgaJpZM4HZuKC>.
|
does this still works for Firebase Cloud Messaging? |
With the Push addition to Parse Server, is it possible to send push notifications from cloud code like before?
Parse.Push.send({});
The text was updated successfully, but these errors were encountered: