# Push Notifications

This document provides some information about the push notifications, that various APIs send to the app using Firebase.

# Structure

All push notifications are structured the same way. It goes as follows:

  • title: Text that will be shown as title of the push notification on the device
  • body: Text that will be shown as body of the push notification on the device
  • imageUrl: Image that will be shown as notification icon on the device.
  • data: JSON that holds arbitrary key values pairs

String is used as data type for all parts of the notification, including the title, the body, the imageUrl, as well as all keys and values within the data JSON. Furthermore, the data JSON will always contain a key type that holds the type, e.g. NewBillAdded or BankingCardAdded, of the push notification as its value. This is used to distinguish between different push notifications, that trigger different logic within the app. For instance reloading the bill overview to show the newly added bill, if a new one has been added. For some types some additional information can be found within the data JSON. The exact types are described below.

# Example

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    ...
  }
}

# Push Notification Types

# Generic

Used when only informing the user and no special action is required within the app.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "Generic"
  }
}

# NewBill

Used when a new bill has been added to the user. This also sets the key bill_matched_via_banking_card with the value True in the data JSON.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "NewBill",
    "bill_matched_via_banking_card": "True"
  }
}

# BillExportStarted

Used when exporting the bills is started successfully.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "BillExportStarted"
  }
}

# NewBankingCardAddedSuccess

Used when a new banking card has been added successfully to the user by extracting the necessary data from a bill done via card payment. This also sets the key bank_card_link_success with the value True in the data JSON.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "NewBankingCardAddedSuccess",
    "bank_card_link_success": "True"
  }
}

# NewBankingCardAddedError

Used when it was tried to add a new banking card to the user by extracting the data from a bill done via card payment, but adding it failed. This also sets the key bank_card_link_success with the value False in the data JSON.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "NewBankingCardAddedError",
    "bank_card_link_success": "False"
  }
}

# DatevSuccess

Used when a DATEV client was added successfully. This also sets the keys click_action with value FLUTTER_NOTIFICATION_CLICK as well as view with value datev_success.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
      "type": "DatevSuccess",
      "click_action": "FLUTTER_NOTIFICATION_CLICK",
      "view": "datev_success"
  }
}

# DatevError

Used when adding a DATEV client failed. This also sets the keys click_action with value FLUTTER_NOTIFICATION_CLICK, view with value datev_failed, message with the error message as value, errorUri with the URI of the error as value, error with the name of the error as value and requestId with the ID of the request as value.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
      "type": "DatevError",
      "click_action": "FLUTTER_NOTIFICATION_CLICK",
      "view": "datev_failed",
      "error": "ThisIsAndError",
      "errorUri": "this/is/the/error/uri",
      "message”": "Super nice error message exactly describing the problem",
      "requestId": "12345"
  }
}

# WarrantyReminder

Used when the warranty of a product bought within a user bill is expiring.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "WarrantyReminder"
  }
}

# FinoSynchronisation

Used when a banking account of the user has been added through via Fino. This also sets the keys service with the value fino and action with the value added.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "FinoSynchronisation",
    "service": "fino",
    "action": "added"
  }
}

# FinoDisconnected

Used when a banking account of the user has been removed via Fino. This also sets the keys service with the value fino and action with the value deleted.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "FinoDisconnected",
    "service": "fino",
    "action": "deleted"
  }
}

# FinoChallengeRequired

Used when an additional challenge is required for linking the banking account via Fino. This also sets the key bankId with the value being the internal Id of the bank.

{
  "title": "42",
  "body": "The purpose of life",
  "imageUrl": "https://static.scientificamerican.com//file/6707FBEA-499C-41ED-9532AB44DDA359C1_source.jpg",
  "data": {
    "type": "FinoChallengeRequired",
    "bankId": "<inernal_bank_id>"
  }
}