Search code examples
androidcordovaionic-frameworkcordova-pluginspushwoosh

Post event not working on PushWoosh cordova SDK


I'm trying to post events from my Ionic app to PushWoosh in order to show In-App Messages but it's not working.

In the docs there is a Javascript example. I tried with:

pushNotification.postEvent(JSON.stringify({
  "event": "Test event",
  "attributes": {
    "test": true,
  },
  "success": successCallback, // optional
  "error": errorCallback // optional
}));

But the event is not triggered.

I look into the plugin files and the interface says different things about the usage of that method:

//Function: postEvent
//[android, ios] Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
//
//Parameters:
// "event" - event to trigger
// "attributes" - object with additional event attributes
// 
// Example:
//(start code)
// pushwoosh.setUserId("XXXXXX");
// pushwoosh.postEvent("buttonPressed", { "buttonNumber" : 4, "buttonLabel" : "banner" });
//(end)
PushNotification.prototype.postEvent = function(event, attributes) {
    exec(null, null, "PushNotification", "postEvent", [event, attributes]);
};

Because of that, I tried with:

pushNotification.postEvent('Test event', {
   "test": true
});

But it does not work either.

So, the app is registering the device ok, the push notifications are also working, but I can't push events. (In the dashboard, the trigger count is 0).

Any ideas? Thank's in advance!!


Solution

  • I solved it creating a new free account (with free-trial) because my personal account was created a while ago, and using the postEvent method in the form it was specified in the interface:

    pushNotification.postEvent('Test event', {
       "test": true
    });
    

    The docs seems to be outdated.