Skip to content

Instantly share code, notes, and snippets.

@N-Upchurch
Last active October 5, 2021 18:09
Show Gist options
  • Save N-Upchurch/4503ce394852dd09a5819cb791999133 to your computer and use it in GitHub Desktop.
Save N-Upchurch/4503ce394852dd09a5819cb791999133 to your computer and use it in GitHub Desktop.
Node-Red Gotifier - Send Notifications Through Gotify

About

This flow creates a simple UI on the dashboard to send push notifications via Gotify. Simply set your Gotify server base URL and app token in the credentials node.

Image of Flow:

flow

Image of UI:

flow1

[
{
"id": "761e2d49685748c6",
"type": "tab",
"label": "Gotifier - Send Notifications",
"disabled": false,
"info": "Send a custom push notification via Gotify."
},
{
"id": "0a07eb38827d4d4d",
"type": "http request",
"z": "761e2d49685748c6",
"name": "Send Request",
"method": "POST",
"ret": "obj",
"paytoqs": "body",
"url": "{{{serverBaseURL}}}/message?token={{appToken}}",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 920,
"y": 260,
"wires": [
[
"1db22973dac45953",
"21c0c7a49cf8c834"
]
]
},
{
"id": "df66206a0eaf57e3",
"type": "credentials",
"z": "761e2d49685748c6",
"name": "Data: Server URL & App Token",
"props": [
{
"value": "appToken",
"type": "msg"
},
{
"value": "serverBaseURL",
"type": "msg"
}
],
"x": 710,
"y": 260,
"wires": [
[
"0a07eb38827d4d4d"
]
]
},
{
"id": "cdf7a61aabd2f45b",
"type": "ui_form",
"z": "761e2d49685748c6",
"name": "Message Form",
"label": "",
"group": "ec74d5c2056e102f",
"order": 5,
"width": 0,
"height": 0,
"options": [
{
"label": "Title",
"value": "title",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Message",
"value": "message",
"type": "text",
"required": true,
"rows": null
}
],
"formValue": {
"title": "",
"message": ""
},
"payload": "",
"submit": "submit",
"cancel": "cancel",
"topic": "topic",
"topicType": "msg",
"splitLayout": "",
"className": "",
"x": 460,
"y": 220,
"wires": [
[
"b54a793a929d81c0"
]
]
},
{
"id": "b083cb84ce95d52c",
"type": "ui_slider",
"z": "761e2d49685748c6",
"name": "priority",
"label": "Message Priority",
"tooltip": "",
"group": "ec74d5c2056e102f",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"outs": "end",
"topic": "topic",
"topicType": "msg",
"min": 0,
"max": 10,
"step": 1,
"className": "",
"x": 430,
"y": 160,
"wires": [
[
"9cd30fa332737e6a"
]
]
},
{
"id": "9cd30fa332737e6a",
"type": "change",
"z": "761e2d49685748c6",
"name": "",
"rules": [
{
"t": "set",
"p": "priority",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 560,
"y": 160,
"wires": [
[]
]
},
{
"id": "b54a793a929d81c0",
"type": "change",
"z": "761e2d49685748c6",
"name": "",
"rules": [
{
"t": "set",
"p": "payload.priority",
"pt": "msg",
"to": "priority",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 220,
"wires": [
[
"df66206a0eaf57e3"
]
]
},
{
"id": "ad309df69537acf4",
"type": "template",
"z": "761e2d49685748c6",
"name": "Payload: Success",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Notification sent succesfully!",
"output": "str",
"x": 1170,
"y": 200,
"wires": [
[
"0205db3a4af83546"
]
]
},
{
"id": "0205db3a4af83546",
"type": "ui_toast",
"z": "761e2d49685748c6",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"className": "",
"topic": "",
"name": "",
"x": 1160,
"y": 240,
"wires": []
},
{
"id": "1db22973dac45953",
"type": "switch",
"z": "761e2d49685748c6",
"name": "Success?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1140,
"y": 160,
"wires": [
[
"ad309df69537acf4"
]
]
},
{
"id": "21c0c7a49cf8c834",
"type": "switch",
"z": "761e2d49685748c6",
"name": "Failure?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "200",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1140,
"y": 340,
"wires": [
[
"ba11ec746f458636"
]
]
},
{
"id": "ba11ec746f458636",
"type": "template",
"z": "761e2d49685748c6",
"name": "Payload: Failure",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Notification Failed to send :[",
"output": "str",
"x": 1160,
"y": 380,
"wires": [
[
"1fc522e03fc7c889"
]
]
},
{
"id": "1fc522e03fc7c889",
"type": "ui_toast",
"z": "761e2d49685748c6",
"position": "top right",
"displayTime": "3",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"className": "",
"topic": "",
"name": "",
"x": 1160,
"y": 420,
"wires": []
},
{
"id": "ec74d5c2056e102f",
"type": "ui_group",
"name": "Send a Notification",
"tab": "951018d278c90a6e",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "951018d278c90a6e",
"type": "ui_tab",
"name": "Gotifier - Send Notifications",
"icon": "fa-comment",
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment