How to send a promotional image in the push notification in MFP

267 Views Asked by At

How to send the promotional image in the push notification as it is like the below image? Do I need to use any html code in payload? If possible kindly share the code snippet.

like this.

1

There are 1 best solutions below

1
Vivin K On

Edit April 2019:

IBM MobileFirst 8.0 supports sending rich push notifications. Update to the latest server and client side fix packs to get the feature. Use the following payload structure when dispatching Push:

Push payload:

{  
   "message":{  
      "alert":"Picture Notification for Android devices ",
      "url":"http://www.test.com"
   },
   "target":{  
      "deviceIds": ["MyDeviceId1", ...],
      "platforms": ["A,G", ...],
      "tagNames": ["Gold", ...],
      "userIds": ["MyUserId", ...]
   },
   "settings":{  
      "gcm":{  
         "style":{  
            "notification_type":"PICTURE_NOTIFICATION",
            "url":"<URL of the image that needs to be displayed>",
            "title":"Test"
         },
      "apns": {
         "attachmentUrl" : "http://test.com/test.png",
         "badge" : 1,
         "category" : 1,
         "iosActionKey" : "Ok",
         "launchImage" : "test.png",
         "locArgs" : [ "["Shelly"]", ... ],
         "locKey" : "REQ_FORMAT",
         "payload" : {"custom":"data"},
         "sound" : "song.mp3",
         "subtitle" : "Sub Title",
         "title" : "Title",
         "titleLocArgs" : [ "["Shelly"]", ... ],
         "titleLocKey" : "REQ_FORMAT",
         "type" : "SILENT"
        }
      }
   }
}