N
Novu13mo ago
Físundur

How to send silent pushes using APNs provider?

Hi everybody, hope you are all doing well! I use APNs provider to send pushes to iOS subscribers. And the problem is I don't know how to override payload to send silent push notifications. I tried to set a hashmap in Overrides field like this:
{
"aps": {
"content-available": 1
}
}
{
"aps": {
"content-available": 1
}
}
And I expect the same structure on another side — iOS app but instead I get this structure:
"aps" : {
"alert" : {
"title" : "<REPLACE_WITH_DATA>",
"body" : "<REPLACE_WITH_DATA>\n<REPLACE_WITH_DATA>"
}
}
"aps" : {
"alert" : {
"title" : "<REPLACE_WITH_DATA>",
"body" : "<REPLACE_WITH_DATA>\n<REPLACE_WITH_DATA>"
}
}
It seems like Novu doesn't understand that he needs to send background push instead of alert type. Here is some log from Activity Feed:
curl --location --request POST 'https://api.myhost.com/v1/events/trigger' \
--header 'Authorization: ApiKey <REPLACE_WITH_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "info-push",
"to": {
"subscriberId": "some_valid_id"
},
"payload": {
"body": "<REPLACE_WITH_DATA>",
"link": "<REPLACE_WITH_DATA>",
"title": "<REPLACE_WITH_DATA>",
"__source": "test-workflow"
},
"overrides": {
"aps": {
"content-available": 1
}
},
"tenant": null
}'
curl --location --request POST 'https://api.myhost.com/v1/events/trigger' \
--header 'Authorization: ApiKey <REPLACE_WITH_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "info-push",
"to": {
"subscriberId": "some_valid_id"
},
"payload": {
"body": "<REPLACE_WITH_DATA>",
"link": "<REPLACE_WITH_DATA>",
"title": "<REPLACE_WITH_DATA>",
"__source": "test-workflow"
},
"overrides": {
"aps": {
"content-available": 1
}
},
"tenant": null
}'
The problem with this log is absense of header key apns-type with value background. How to solve it? How to send silent pushes using APNs provider? p.s. My app is currently working well and now CloudKit sends correct silent pushes if I use content-available inside aps without any other keys like title and body. p.p.s. I've recently checked another topic but related to FCM instead right below. https://discord.com/channels/895029566685462578/1057055266631327754/1057055266631327754 The same solution is really needed for APNs provider. Now it's only possible to send alert type pushes to APNs, unfortunately, as far as I can see.
4 Replies
Pawan Jain
Pawan Jain13mo ago
@Raikas do you have any idea on how to send silent apns push notification
Raikas
Raikas13mo ago
Overrides? Ah, they're using them already. Hmm 🤔
Físundur
FísundurOP13mo ago
Yeah, we are already using overrides field and when we trigger event, we get a classic alert-type push notification instead of silent (or data/background) push notification.
Pawan Jain
Pawan Jain12mo ago
@Físundur We have a demo guide for FCM and APNS Push with ios device in our todo list. We will share it with you once it is ready cc:- @DevRel ref:- FCM Linear Ticket
Want results from more Discord servers?
Add your server