I'm trying to add TTL to push notification payload so messages are either delivered in the next 16 hours (57600 seconds) or discarded by FCM. While messages themselves being sent/delivered with payload attached below only Android TTL value is honoured by FCM on fan out. I set up data transfer to Big Query for Firebase Messaging and it shows that TTL is standard 28 days (2419200 seconds) for non-Android platforms.
The question is: what am I possibly missing, and how to properly pass TTL for Webpush and APNS payload to be honoured by FCM?
A little overview of environment setup - there's PHP server which prepares push notification payload and sends it to Firebase Cloud Function, cloud function then retrieves payload and calls admin.messaging().send() with it as a param.
I used these docs to pass values for Web and iOS: https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.webpushconfig https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.apnsconfig
And here's an example payload I'm passing to admin.messaging().send():
{
"webpush": {
"headers": {
"TTL": "57600",
"Urgency": "normal"
},
"notification": {
"title": "Test Tokens Send",
"body": "Test",
"tag": "test-recommended-reads",
"icon": "/wp-content/uploads/.../icon-512.png"
},
"data": {
"title": "Test Tokens Send",
"body": "Test",
"tag": "test-recommended-reads",
"clickType": "openPost",
"clickValue": "{\"postId\":999999,\"postUrl\":\"https:\\/\\/some.site\\/post-name?utm_source=SITE&utm_medium=Notification&utm_campaign=test-recommended-reads\"}"
}
},
"apns": {
"headers": {
"apns-expiration": "1707780517"
},
"payload": {
"aps": {
"alert": {
"title": "Test Tokens Send",
"body": "Test"
},
"mutableContent": true
},
"clickType": "openPost",
"clickValue": "{\"postId\":999999,\"postUrl\":\"https:\\/\\/some.site\\/post-name?utm_source=SITE&utm_medium=Notification&utm_campaign=test-recommended-reads\"}"
}
},
"android": {
"ttl": 57600000,
"priority": "normal",
"data": {
"title": "Test Tokens Send",
"body": "Test",
"tag": "test-recommended-reads",
"clickType": "openPost",
"clickValue": "{\"postId\":999999,\"postUrl\":\"https:\\/\\/some.site\\/post-name?utm_source=SITE&utm_medium=Notification&utm_campaign=test-recommended-reads\"}"
}
},
"fcm_options": {
"analytics_label": "test-recommended-reads_24-02-12_07:28"
},
"topic": "test-recommended-reads"
}