Físundur
Físundur
NNovu
Created by Físundur on 11/8/2023 in #💬│support
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.
7 replies