How to Create Subdomain in XAMPP

28-02-2017

We can use following Javascript & Angular JS code to send push notification in OneSignal by using FILTER property:

    var content={};
    content.en="Test message";
    var filters=[];
    filter={};
    filter.field="tag";
    filter.key="authorId";
    filter.relation="=";
    filter.value=54;
    filters.push(filter);

    parameter = JSON.stringify({
        app_id: "31ee45e2-c63d-4048-903a-89ca43f3afa4",
        contents:content,
        filters: filters
    });

    $http.post("https://onesignal.com/api/v1/notifications", parameter, {
        headers: {
            'Authorization': 'Basic YzUzNmZkOTAtMmVlMC00OWIzLThlNGQtMzQyYzIyNmFhZjcw',
            'Content-Type': 'application/json; charset=utf-8'
        }
    }).success(function (data) {
        console.log(data);
        $scope.showAlert("İşlem Sonucu", "Sorunuz başarılı bir şekilde iletildi");

    }).error(function (data) {
        $scope.showAlert("Hata", "Sorunuz iletilirken hata oluştu");
    });

Line 12: 31ee45e2-c63d-4048-903a-89ca43f3afa4 is APP ID,

Line 19: YzUzNmZkOTAtMmVlMC00OWIzLThlNGQtMzQyYzIyNmFhZjcw is Onesignal REST API KEY

© 2019 All rights reserved. Codesenior.COM