Hi all,
activitree:push has moved to V2. For the few who were using V1, there are some breaking changes explained in the repo.
For the rest, please do add it to your small or larger projects, ask the questions, open the issues etc.
This package is probably the most advances and future proof option for Meteor.
We dropped APN from the package due to no decent APN support server side for Node. IOS 13 was only supported via a community APN-Node maintained package so it made sense to move everything to FCM.
The package is still missing some parts but they will be developed as issues/request get open. (E.g complex listeners for Cordova.)
Responding to some user requests, the package takes now payloads of any kind (as supported by Firebase), a global data object and override data objects for each of IOS, Android, or PWA.
Another request implemented was related to queries. It is now possible to send to a user or list of users, a token or list of tokens, a tokenId or list of tokenIds.
I am open to anyone with “special” needs for Push like for instance for Meteor with React-Native, Electron, etc.
Structure of the complete FCM Notification as implemented in activitree:push
const note = {
android: {
// ttl: '86400s', // use default max of 4 weeks
// collapse_key: string,
priority: defaults.priority,
// restricted_package_name: string,
data: {
title: mongoNote.title,
body: mongoNote.body,
icon: mongoNote.icon || defaults.icon,
color: mongoNote.color || defaults.color,
sound: mongoNote.sound || defaults.sound,
tag: `${mongoNote.notId}`,
// click_action: mongoNote.action
channel_id: mongoNote.channelId || defaults.channelId || defaults.topic,
notification_priority: mongoNote.notificationPriority || defaults.notificationPriority,
visibility: mongoNote.visibility || defaults.visibility,
// notification_count: mongoNote.badge || defaults.badge, // this is supposed to be a number, can't send it because I need it to be a string.
image: mongoNote.imageUrl || defaults.imageUrl,
...globalData,
...noteAndroidData
},
fcm_options: {
analytics_label: mongoNote.analyticsLabel || defaults.analyticsLabel
}
},
apns: {
headers: {
'apns-priority': defaults.apnsPriority,
},
payload: {
aps: {
alert: {
title: mongoNote.title,
body: mongoNote.body,
'launch-image': mongoNote.launchImage || defaults.launchImage
},
badge: mongoNote.badge || defaults.badge,
sound: mongoNote.sound ? `${mongoNote.sound}.caf` : defaults.sound ? `${defaults.sound}.caf` : '',
// 'click-action' // TODO check on this,
data: {
...defaults.data,
...defaults.iosData,
...globalData,
...noteIosData
}
}
},
fcm_options: {
analytics_label: mongoNote.analyticsLabel || defaults.analyticsLabel,
image: mongoNote.imageUrl || defaults.imageUrl
}
},
webpush: {
headers: {
Urgency: 'high',
TTL: defaults.webTTL, // mandatory, in seconds
},
data: {
...defaults.data,
...defaults.webData,
...globalData,
...noteWebData
},
notification: {
title: mongoNote.title,
body: mongoNote.body,
icon: mongoNote.webIcon || defaults.webIcon,
image: mongoNote.imageUrl || defaults.imageUrl
/*
actions: [
{
action: mongoNote.action || defaults.action,
title: 'Book Appointment'
}
]*/
}, // Can take valued from here: https://developer.mozilla.org/en-US/docs/Web/API/Notification.
fcm_options: {
link: mongoNote.action || defaults.action
}
}
}
Regards