Add sent-at time to notification payload

This commit is contained in:
Pete Schwamb
2022-04-20 10:12:37 -05:00
parent 5a96281a12
commit 537ed5e7cd
+5 -1
View File
@@ -112,8 +112,12 @@ function init (env, ctx) {
alert += " - " + data.enteredBy
}
// Track time notification was sent
let now = new Date()
payload['sent-at'] = now.toISOString();
// Expire after 5 minutes.
let expiration = new Date((new Date()).getTime() + 5 * 60 * 1000)
let expiration = new Date(now.getTime() + 5 * 60 * 1000)
payload['expiration'] = expiration.toISOString();
let notification = new apn.Notification();