Pushwoosh Remote API for cordova

I want to send push notifications from the client (my cordova (ionic) app) through pushwoosh.

Is there any sample code or guides for that?

Thanks!

Have a look at the plugin for Phonegap https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin and the documentation on Pushwoosh site https://www.pushwoosh.com/programming-push-notification/ios/ios-additional-platforms/push-notification-sdk-integration-for-phonegap/.

You have to use the Remote Access API which requires a paid plan. I create an object that contains the text I want to send and the device tokens I want to send it to and pass that as an argument to the following function:

function push(object) {
  var params = {
    "request": {
      "application": "PW_ID GOES HERE",
      "auth": "Find in your API Access page",
      "notifications": [{
        // Content Settings
        "send_date": "now",
        "ignore_user_timezone": true,
        "content": {
          "en": object.text
        },
        "platforms": [1, 3], // 1 - iOS; 3 - Android;
        // iOS Related
        "ios_category_id": "1",
        "ios_badges": "+1",
        // Android Related
        "android_icon": "icon",
        // Who to send it to
        "devices": object.tokens
      }]
    }
  };
  $http.post('https://cp.pushwoosh.com/json/1.3/createMessage', params).then(success, failure);

  function success() {
    console.log("successful notification push");
  }

  function failure(error) {
    console.log('error sending notification', error);
  }
}