genesluder / python-apns

A library for interacting with APNs using HTTP/2 and token-based authentication.
MIT License
90 stars 50 forks source link

APNS Payload getting to device is in different format which sent to client #37

Open DeepthiJonnagaddla opened 2 years ago

DeepthiJonnagaddla commented 2 years ago

Hi,

We are facing issue with payload message what server sending is not retrieving at device. Could someone please let me know where we are missing in the below payload structure.

This is the server side code sending to client :

if tuser.apns_token:
                    token = tuser.apns_token
                    message = {
                        "title": from_tuser.name,
                        "body": message,//"Fdfdsf"
                        "jid": message_from,
                        "content-available": 1,
                        "xml": xml,
                        "sound": "default",
                    }
                    logger.info('Payload: %s' % message)
                    result = client.send_message(token, message)

But receiving this payload in device :

{
"body": Fdfdsf, 
"google.c.fid": xxxxxxxx,
 "google.c.sender.id": xxxxxxxxx,
 "gcm.message_id": xxxxxxxx,
 "aps": {
    "content-available" = 1;
},
 "Nick": DeepthiJonna
}

Expecting Payload is :

{ "body": { "title": from_tuser.name, "body": "Fdfdsf", "jid": message_from, "content-available": 1, "xml": xml
"sound": "default", }, "google.c.fid": xxxxxxxx, "google.c.sender.id": xxxxxxxxx, "gcm.message_id": xxxxxxxx, "aps": { "content-available" = 1; }, "Nick": DeepthiJonna }