Skip to content

Instantly share code, notes, and snippets.

@plainice
Last active May 13, 2020
Embed
What would you like to do?
iOS/Android interactive notifications in Node-red using https://pushback.io
[
{
"id": "a19ded95.90937",
"type": "inject",
"z": "ee6ceb5d.f3edd8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 100,
"y": 300,
"wires": [
[
"19e520cc.ef8edf"
]
]
},
{
"id": "8413feae.5b81d",
"type": "debug",
"z": "ee6ceb5d.f3edd8",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 700,
"y": 420,
"wires": []
},
{
"id": "4a8184c5.28b73c",
"type": "http request",
"z": "ee6ceb5d.f3edd8",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "https://api.pushback.io/v1/send_sync",
"tls": "",
"persist": true,
"proxy": "",
"authType": "bearer",
"x": 450,
"y": 300,
"wires": [
[
"19b207cc.7764e8"
]
]
},
{
"id": "19e520cc.ef8edf",
"type": "function",
"z": "ee6ceb5d.f3edd8",
"name": "Set payload",
"func": "msg.payload = JSON.stringify({\n title: 'Node-red notification',\n ID: \"Channel_1010\",\n body: 'Get responses',\n action1: `Hello ${msg.payload}`,\n action2: \"Date\",\n reply: \"Reply\"\n})\nmsg.headers = {};\n\nmsg.headers['Content-Type'] = 'application/json';\nmsg.requestTimeout = 86400000; // 1 day\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 300,
"wires": [
[
"4a8184c5.28b73c"
]
]
},
{
"id": "a803b573.ae5a78",
"type": "switch",
"z": "ee6ceb5d.f3edd8",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "hello",
"vt": "str",
"case": true
},
{
"t": "regex",
"v": "date",
"vt": "str",
"case": true
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 470,
"y": 480,
"wires": [
[
"8413feae.5b81d"
],
[
"e6930b9e.b6d6c8"
]
]
},
{
"id": "e6930b9e.b6d6c8",
"type": "function",
"z": "ee6ceb5d.f3edd8",
"name": "Date",
"func": "// Create a Date object from the payload\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nmsg.payload = date.toString();\n// Return the message so it can be sent on\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 650,
"y": 560,
"wires": [
[
"288e8dc7.078f52"
]
]
},
{
"id": "288e8dc7.078f52",
"type": "debug",
"z": "ee6ceb5d.f3edd8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 810,
"y": 560,
"wires": []
},
{
"id": "19b207cc.7764e8",
"type": "debug",
"z": "ee6ceb5d.f3edd8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 630,
"y": 300,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment