Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

FCM Message format

Jacqueline Bronger edited this page May 1, 2018 · 1 revision

This page describes the payload of a message received via FCM (Firebase Cloud Messaging). The whole object is the payload of the FCM Message - do not confuse the payload of the message with the payload of the FCM message, these are two different things. Structure is as follows:

FCM Message -> FCM Payload -> TCA Message -> TCA Payload

General layout

{
  "type": 1,
  "notification": 0,
  "payload": {
    "room": 1,
    "member": 1,
    "message": "hello world"
  }
}
  1. type: integer - describes the format of the json payload
    • 0 - do nothing
    • 1 - Chat message
    • 2 - Update
    • 3 - Alert
  2. notification: integer - notification id on the server (PK)
  3. payload: string - contains a json formatted string which contains the data. This string should be parsed by the client library. The total limit of a FCM message is currently 4kBs.

Type 0: Do nothing

This message type should do nothing but inform the server that it received this FCM notification. Refer to the backend documentation for further information

Type 1: Chat

{
  "type": 1,
  "notification": 0,
  "payload": {
    "room": 1,
    "member": 1,
    "message": -1
  }
}
  1. room: integer - the room id which has a new message
  2. member: integer - the member which posted the message
  3. message: integer - only used when a message gets updated - otherwise null

Type 2: Update

{
  "type": 2,
  "notification": 0,
  "payload": {
    "packageVersion": 50,
    "sdkVersion": 14,
    "releaseDate": "21.12.1970",
    "lowestVersion": 1
  }
}
  1. packageVersion: integer - the version of the newest apk
  2. sdkVersion: integer - the sdk version of the newest apk
  3. releaseDate: integer - the date the version was released
  4. lowestVersion: integer - lowest version which is allowed to use the api. Apps using a version below this should be blocked from accessing any apis. This is meant as emergency block if someday we want to force the users to update to a version.

Type 3: Alert

{
  "type": 3,
  "notification": 0,
  "payload": {
    "silent": false
  }
}
  1. title: string - warning title to show in notification
  2. text: string - information text to display when notification gets clicked
  3. signature: string - RSA Signature of title+text
  4. silent: boolean - play some sort of sound if false (e.g.: beeping)
Clone this wiki locally