parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
88 stars 100 forks source link

Support for Critical Alert #126

Closed iOSDev33 closed 5 years ago

iOSDev33 commented 5 years ago

Just wondering if there is support for sending critical alerts. Basically this makes the sound key a dictionary instead of a string. Currently it appears the class doesn't support it. Below is a sample payload for sending critical push notifications.

{ "aps": { "content-available": 1, "sound": { "critical": 1, "name": "sound", "volume": 1.0 }, "badge": "Increment", "alert": { "title": "Test", "body": "Test" }, "county": "Test" } }

dplewis commented 5 years ago

If you want support for this, you have to head over to https://github.com/node-apn/node-apn module.

This adapter just passes the payload to the module.

Check out the Notification Documentation

It should support this from a quick glance.

dplewis commented 5 years ago

Edit: It looks like somebody beat you to it. https://github.com/node-apn/node-apn/pull/646/

You have to wait for that PR to be submitted and released

iOSDev33 commented 5 years ago

Hi @dplewis, Thanks for the quick response. How could this be used with parse-server? I am currently pushing from a python script. Please see below.

def sendPush():

    connection = httplib.HTTPSConnection('yourserver', 443)
connection.connect()
connection.request('POST', "/parse/push", json.dumps({
    "where": {
        "channels": channel,
    },
    "data": {
        "content-available": 1,
        "sound": {
                    "critical": 1,
                    "name": "sound",
                    "volume": 1.0
                },
        "badge": "Increment",
        "alert": {
                    "title": title,
                    "body": message
                },
        }
    }), {
    "X-Parse-Application-Id": appID,
    "X-Parse-Master-key": masterKey,
    "Content-Type": "application/json"
})
result = json.loads(connection.getresponse().read())`
dplewis commented 5 years ago

Could you please post this over on Stack Overflow with the parse-platform tag.

We are trying to keep GitHub issues reserved for bug reports & feature requests - see the section on help and communication on our website.