Pushbullet - Fix sms missing notifications issue

to close #936
This commit is contained in:
Dave Conway-Jones 2022-08-20 18:56:34 +01:00
parent e5e8a33d80
commit d913171f40
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 10 additions and 5 deletions

View File

@ -221,8 +221,14 @@ module.exports = function(RED) {
msg.payload = incoming.iden;
}
else if (incoming.type === 'sms_changed') {
msg.topic = "SMS: "+ incoming.notifications[0].title;
msg.payload = incoming.notifications[0].body;
if (incoming.notifications && incoming.notifications.length > 0) {
msg.topic = "SMS: "+ incoming.notifications[0].title;
msg.payload = incoming.notifications[0].body;
}
else {
msg.topic = "SMS: ";
msg.payload = "";
}
msg.message = incoming;
}
else {
@ -244,12 +250,11 @@ module.exports = function(RED) {
function PushbulletOut(n) {
RED.nodes.createNode(this, n);
var self = this;
this.title = n.title;
this.chan = n.chan;
this.pushtype = n.pushtype;
this.pusher = null;
var self = this;
var configNode;

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pushbullet",
"version" : "0.0.17",
"version" : "0.0.19",
"description" : "A Node-RED node to send alerts via Pushbullet",
"dependencies" : {
"pushbullet": "^2.4.0",