Skip to content

Push notification payload

Peter Vojtek edited this page Oct 13, 2016 · 24 revisions

Current inner push notification payload:

  • title - usually username, e.g. John Doe
  • message - message description text (e.g. posted Learn to fly
  • image - notification image URL
  • count - badge count
  • P.V. not sure if we need it here at all
  • additionalData
  • additionalData
    • badgeCount -- the same as count above
  • type -- type of push notification, e.g. boosted_post
  • actions -- action buttons, only on Android
    • example: [{"callback":"app.upvote","icon":"Upvote","title":"Upvote"}]
  • entity
    • target
      • id -- e.g. post ID
      • type -- e.g. post
      • other attributes, e.g. commentID

example:

{"message":"posted: try boost 2","image":"http://powerline-dev.imgix.net/avatars/577cb68e6f276.jpeg?dpr=0.75&h=400&ixlib=php-1.1.0&w=320","title":"Peter10 Is Leader","count":"13","additionalData":{"collapse_key":"do_not_collapse","type":"follow-post-created","additionalData":{"badgeCount":13},"foreground":true,"actions":[{"callback":"app.upvote","icon":"Upvote","title":"Upvote"}],"coldstart":false,"entity":{"target":{"id":350,"body":"try boost 2","image":"577cb68e6f276.jpeg","type":"post","full_name":"Peter10 Is Leader"},"id":2293}}} 

The structure above has following drawbacks:

  • there is type twice, but they have different meaning, one is push notification type and other is entity type..
  • badge count is there twice
  • I do not understand why there is additionalData twice : additionalData.additionalData.badgeCount
  • it is useless to dive that deep the reach entity details (i.e. target.entity), which leads to such complicated if conditions
  • the push notification types should use unified format: -, e.g. post-created.

Here is example how the notification should look like:

  • title - usually username, e.g. John Doe
  • message - message description text (e.g. posted Learn to fly
  • image - notification image URL
  • badgeCount - badge count
  • additionalData
  • notificationType -- type of push notification, e.g. boosted_post
  • actions -- action buttons, only on Android
    • example: [{"callback":"app.upvote","icon":"Upvote","title":"Upvote"}]
  • entity
    • id -- e.g. post ID
    • type -- e.g. post-created
    • other attributes, e.g. commentID
Clone this wiki locally