we have implemented apple apns push notification. Configured pem file and device tokens in python. They trigger json payload like this
{"aps" : { "alert" : "got 1 new offer. To view, please tap here." },"notification_type":"New Offer history","redirect_link”:”offers”}.
we got notification, but the full json shows in message. we need to display only alert message only on notification message
I think for notification to display data instead of json in push try below json
{
"aps":{
"alert":"This is your message to be displayed",
"sound":"default",
"badge":1
},
"Data":{"key1":"val1", "key2":"val2"}
}
The alert content will be displayed in push and the Data Key/Val pairs is your custom data that you can pass in payload and access it in your code.
The code shared above is the working code I have used in most of my API projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With