Skip to content

Push notifications

Each app writes user's FCM token to /pushRegistrations/<uid>/<token>:

      "push_token_1": {
        "platform": "android",
        "version": "1666", // version of the app, used to control if given push is supported 
        "url": "url" // legacy, used only for Windows app
      },

Then when there is a change in any of the user's group backend notifies them using their token(s). If the token is marked as expired it gets deleted from database.

The structure of notifications depends on the payload, but generally Android & Web use raw payload, meaning when they receive the notification they do further post-processing before they actually show it. iOS on the other hand receives and displays the notification as is, using loc keys for localizations.

List of supported push notifiations

export type RawNotificationAction = 
  ActionType | 
  'debt_reminder' |
  'archive_reminder' |
  'referral_reward_complete' |
  'referral_reward_progress';

export type IosNotificationTitle = 
  'notification_title' |
  'notification_title_referral_reward_complete' |
  'notification_title_referral_reward_progress' | 
  'notification_title_archive_reminder';

export type IosNotificationBody = 
  `notification_body_${EntityType}_${ActionType}` | 
  `notification_body_${EntityType}_${ActionType}_self` | 
  `notification_body_${EntityType}_${ActionType}_someone` | 
  'notification_body_referral_reward_complete' | 
  'notification_body_referral_reward_progress' |
  'notification_body_remember_to_pay' | 
  'notification_body_archive_reminder';

Notification payloads

Applicable for Android and Web.

{
  "action": "archive_reminder",
  "groupId": "123",
  "groupName": "Skupina",
  "daysBeforeArchival": "42",
  "daysInactive": "14"
}
{
  "action": "debt_reminder",
  "amount": "145",
  "groupId": "123",
  "fromMemberId": "1",
  "toMemberId": "2",
  "currency": "CZK",
  "formattedAmount": "125 Kč",
  "fromMemberName": "Tomas",
  "toMemberName": "Pepa",
  "groupName": "Skupina"
}