SIGNL4 Category Management

SIGNL4 is a mobile alerting and incident response service.

This flow is using the REST API to manage categories, e.g. for automatically creating a standard set of categories for new teams.

[{"id":"e09a27d99f0ba5c3","type":"tab","label":"SIGNL4 Categories","disabled":false,"info":"","env":[]},{"id":"a551763e.17b798","type":"debug","z":"e09a27d99f0ba5c3","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":140,"wires":[]},{"id":"8a4daa77.db84c8","type":"inject","z":"e09a27d99f0ba5c3","name":"GetTeams","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":140,"wires":[["1459cff3.6e993"]]},{"id":"67556a91.2bed74","type":"http request","z":"e09a27d99f0ba5c3","name":"","method":"use","ret":"txt","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":140,"wires":[["8df4866e.e32e48"]]},{"id":"1459cff3.6e993","type":"function","z":"e09a27d99f0ba5c3","name":"","func":"\nvar strAPIKey = 'your-signl4-api-key';\n\nmsg.url = 'https://connect.signl4.com/api/v2/teams'\nmsg.method = 'GET';\nmsg.headers = {};\nmsg.headers['X-S4-Api-Key'] = strAPIKey;\nmsg.payload = '';\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":220,"y":200,"wires":[["67556a91.2bed74"]]},{"id":"ae9585bb.839d28","type":"function","z":"e09a27d99f0ba5c3","name":"","func":"\nvar result = \"\";\n\nfor (var i = 0; i < msg.payload.length; i++) {\n    result += msg.payload[i].name + \": \" + msg.payload[i].id + \"\\r\\n\";\n}\n\nmsg.payload = result;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":180,"wires":[["a551763e.17b798"]]},{"id":"8df4866e.e32e48","type":"json","z":"e09a27d99f0ba5c3","name":"","property":"payload","action":"","pretty":true,"x":470,"y":80,"wires":[["ae9585bb.839d28"]]},{"id":"6f2981f8.37844","type":"debug","z":"e09a27d99f0ba5c3","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":380,"wires":[]},{"id":"352f272c.2a5268","type":"inject","z":"e09a27d99f0ba5c3","name":"AddCategory","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":380,"wires":[["f8639289.efe94"]]},{"id":"89b8cda7.f2d41","type":"http request","z":"e09a27d99f0ba5c3","name":"","method":"use","ret":"txt","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","x":330,"y":380,"wires":[["6d070334.12bb2c"]]},{"id":"f8639289.efe94","type":"function","z":"e09a27d99f0ba5c3","name":"","func":"\nvar strAPIKey = 'your-signl4-api-key';\nvar strTeamId = 'your-signl4-team-id';\n\nmsg.url = 'https://connect.signl4.com/api/v2/categories/' + strTeamId;\nmsg.method = 'POST';\nmsg.headers = {};\nmsg.headers['X-S4-Api-Key'] = strAPIKey;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\nmsg.payload = {\n    \"augmentations\": [\n      {\n        \"enabled\": false,\n        \"name\": \"\",\n        \"type\": \"Subject\",\n        \"value\": \"\"\n      },\n      {\n        \"enabled\": false,\n        \"name\": \"\",\n        \"type\": \"Location\",\n        \"value\": \"\"\n      },\n      {\n        \"enabled\": false,\n        \"name\": \"\",\n        \"type\": \"Text\",\n        \"value\": \"\"\n      }\n    ],\n    \"color\": \"#30AFE5\",\n    \"imageName\": \"bug.svg\",\n    \"keywordMatching\": \"Any\",\n    \"keywords\": [\n      \"keyword1\",\n      \"keyword2\"\n    ],\n    \"name\": \"MyNewCategory\"\n  };\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":440,"wires":[["89b8cda7.f2d41"]]},{"id":"cdb0afa.f3fef5","type":"function","z":"e09a27d99f0ba5c3","name":"","func":"\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":420,"wires":[["6f2981f8.37844"]]},{"id":"6d070334.12bb2c","type":"json","z":"e09a27d99f0ba5c3","name":"","property":"payload","action":"","pretty":true,"x":450,"y":320,"wires":[["cdb0afa.f3fef5"]]},{"id":"1f9caafcb214b8bc","type":"comment","z":"e09a27d99f0ba5c3","name":"Get all teams.","info":"Get all teams.\nSet your SIGNL4 API key and other values in the first function node.\n","x":130,"y":80,"wires":[]},{"id":"6f2df1bcd4d8de77","type":"comment","z":"e09a27d99f0ba5c3","name":"Add category.","info":"Add category.\nSet your SIGNL4 API key and other values in the first function node.\n","x":130,"y":320,"wires":[]}]

Flow Info

Created 1 year, 4 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x2)
  • debug (x2)
  • function (x4)
  • http request (x2)
  • inject (x2)
  • json (x2)
Other
  • tab (x1)

Tags

  • alerting
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option