angularjsnode.jsibm-cloudibm-mobile-services

IBM Push : cannot use sendNotificationByDeviceIds in ibmpush.js


i have a application and use the function sendNotificationByDeviceIds as below:

PushNotificationToConsumer: function(req, res) {

        queryCustomer.find({jpay_no : jpay_no}).done(function(customerReturn){
            if(customerReturn.length > 0){
                var device_id = customerReturn[0].attributes.device_id.toString();
                req.ibmpush.sendNotificationByDeviceIds(message, [device_id], null).then(function(response){
                    res.json({success : true, message : 'Send notification to patient with device_id:' +device_id+ ' successful ' });
                },function(err){                      
                    res.json(err);
                });
            }else{

            }
        }, function(err){
            res.json(err);
        })

    }

The error message: enter image description here

on app.js: I declared ibmpush = require('ibmpush')

please help to give me your thoughts. Thanks


Solution

  • ibmpush is a deprecated node package.

    https://www.npmjs.com/package/ibmpush

    ATTENTION: This service is currently deprecated on Bluemix and will be completely removed shortly. Please use the 2nd generation of Bluemix MobileFirst Services.

    You can use the current Push Swagger docs to implement the functionality you're looking for (using REST API calls):

    https://mobile.ng.bluemix.net/imfpush/