Álvaro Murillo
Álvaro Murillo

Reputation: 140

Sending push notification using Malcom API with custom parameters

I'm trying to send custom parameters in push notifications with Malcom API, but I cann't read them from my iOS application.

Example CURL:

curl -u user:pass -H "Content-Type: application/json" -X POST -d '{ "notification": { "applicationCode": "appUDID", "environment": "SANDBOX", "message": "Message", "udids": [ "00c93096526860d932ba1bf116e752b8f2689675" ], "notificationCustomization": { "customfield": [ {"entry": { "key":"new_id", "value": "25" }} ], "badge": 5 } } }' http://api.mymalcom.com/v3/notification/push

iOS code (AppDelegate):

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    [MalcomLib didReceiveRemoteNotification:userInfo active:[MalcomLib getAppActive]];

}

userInfo contains this information:

{
    aps =     {
        alert = "Message";
        badge = 5;
    };
    notificationId = 521726;
}

Do you know where I can read these parameters?

Upvotes: 4

Views: 195

Answers (1)

Guillermo Ceballos
Guillermo Ceballos

Reputation: 380

I reckon your JSON is not good enough. It should be like this:

{
"notification":{
  "applicationCode":"yourApplicationCode",
  "environment":"SANDBOX",
  "message":"YourMessage",
  "notificationCustomization":{
     "customFields":{
        "entry":[
           {
              "key":"yourkey1",
              "value":"yourvalue1"
           },
           {
              "key":"yourkey2",
              "value":"yourvalue2"
           },
           {
              "key":"yourkey3",
              "value":"yourvalue3"
           }
        ]
     }
  }

} }

Hope this helps.

Upvotes: 4

Related Questions