SNS Push Notifications with image using Node.js?

Viewed 1130

I am using Amazon SNS Mobile Push Notifications both for android and ios. I am quite successful with sending push notification with text and icon only. Now i am trying to send the notification with an image bottom. I searched every where but couldn't find a perfect docs to work on. Any suggestions please.

i installed this package using npm , i used this to send push notification. please refer this link. https://www.npmjs.com/package/sns-mobile

AWS_SNS_App.getUsers(function (err, allDevices) {
        if (err) {
            console.log(err, err.stack); // an error occurred
        } else {

            if (allDevices.length != 0) {
                var totalDevices = 0;
                for (var i = 0; i < allDevices.length; i++) {
                    totalDevices = totalDevices + 1;
                    AWS_SNS_App.sendMessage(allDevices[i].EndpointArn, message, function (err, messageId) {
                        if (err) {
                            console.log('An error occured sending message to device %s');

                            res.send(err);
                        } else {

                            //res.send('Successfully sent a message to device , MessageID was : ' + messageId);
                        }
                    });
                }
                if (totalDevices === allDevices.length) {
                    res.send('Successfully sent a message to all devices');
                }
            }
        }
    });

sendMessage(endpointArn, message, callback) Send a message to a user. The message parameter can be a String, or an Object with the formats below. The callback format is callback(err, messageId).

from docs it indicates to send a endpointArn,message and we will get a callback of any response. what i suppose to send an image along with the image, is that possible or any another way to do that.

thanks.

1 Answers
Related