Search IBM Connections for keywords and post to users from a team list who have used a keyword

The flow is documented via comments in the flow. I'll update this description next week.

[{"id":"1085b37a.e146c5","type":"function","z":"ecd07fb1.a3fa8","name":"Translate msg.payload to msg.freeSyntax","func":"msg.freeSyntax = msg.payload;\n//msg.keywords = msg.payload;\n//msg.tags = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":227,"wires":[["55cf3b2.ccdf1c4","d79da37a.2f2208"]]},{"id":"e99edc2c.02475","type":"inject","z":"ecd07fb1.a3fa8","name":"","topic":"","payload":"search=db2&ps=5","payloadType":"str","repeat":"","crontab":"","once":false,"x":195,"y":227,"wires":[["1085b37a.e146c5"]]},{"id":"55cf3b2.ccdf1c4","type":"ProfilesGet","z":"ecd07fb1.a3fa8","name":"","server":"332513a5.aa7754","target":"syntaxSearch","targetValue":"","mytags":"","mykeywords":"","freesyntax":"","uuid":true,"key":false,"vcard":false,"mail":false,"thename":true,"photo":false,"links":false,"x":849,"y":302,"wires":[["377700b1.eed84","2213f837.40e5b8","2535b54c.8eca22","7c386952.a6dda8"]]},{"id":"d79da37a.2f2208","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"freeSyntax","x":1209,"y":228,"wires":[]},{"id":"377700b1.eed84","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"payload","x":1202,"y":304,"wires":[]},{"id":"2213f837.40e5b8","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":false,"console":"false","complete":"status","x":1199,"y":351,"wires":[]},{"id":"2535b54c.8eca22","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":false,"console":"false","complete":"error","x":1191,"y":395,"wires":[]},{"id":"5f0077a6.e65db8","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"status_url","x":1262.5,"y":1449,"wires":[]},{"id":"a20a20ae.f329b","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"status","x":1251.5,"y":1499,"wires":[]},{"id":"5d96bd1e.59ce24","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"payload","x":1256.5,"y":1399,"wires":[]},{"id":"7c386952.a6dda8","type":"splitter","z":"ecd07fb1.a3fa8","name":"","property":"payload","x":843.5,"y":454,"wires":[["85153020.532848","9acdcae1.37aca"]]},{"id":"85153020.532848","type":"debug","z":"ecd07fb1.a3fa8","name":"split data","active":false,"console":"false","complete":"payload","x":1188.5,"y":454,"wires":[]},{"id":"504fae1f.04d618","type":"function","z":"ecd07fb1.a3fa8","name":"Extract userid","func":"var nodeData = JSON.parse(msg.payload);\nmsg.targetValue = nodeData.userid;\nreturn msg;","outputs":1,"noerr":0,"x":1006.5,"y":530,"wires":[["3dac1a69.3790de","de9271e4.e9892"]]},{"id":"9acdcae1.37aca","type":"json","z":"ecd07fb1.a3fa8","name":"","x":846.5,"y":530,"wires":[["504fae1f.04d618"]]},{"id":"3dac1a69.3790de","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":false,"console":"false","complete":"targetValue","x":1209.5,"y":529,"wires":[]},{"id":"de9271e4.e9892","type":"function","z":"ecd07fb1.a3fa8","name":"To the message, add text to put into the post.","func":"msg.payload = \"tester\";\nreturn msg;","outputs":1,"noerr":0,"x":889.5,"y":675,"wires":[["9920da51.63a82","8632f641.f1dff","975fe5e6.19e4d"]]},{"id":"9920da51.63a82","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"false","x":1195.5,"y":675,"wires":[]},{"id":"8632f641.f1dff","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"targetValue","x":1205.5,"y":721,"wires":[]},{"id":"6de8f4bf.5f5dac","type":"comment","z":"ecd07fb1.a3fa8","name":"Connect output of A to input of B to enable posting to found profiles for users in the team members text file","info":"","x":1100.5,"y":1282,"wires":[]},{"id":"4f61e6a8.1b7258","type":"comment","z":"ecd07fb1.a3fa8","name":"A","info":"","x":634.5,"y":1352,"wires":[]},{"id":"4079a077.16853","type":"comment","z":"ecd07fb1.a3fa8","name":"B","info":"","x":945.5,"y":1354,"wires":[]},{"id":"a340beb7.7e03e","type":"function","z":"ecd07fb1.a3fa8","name":"Format msg for profiles node","func":"msg.targetValue = msg.targetValue;\nmsg.payload = msg.dataToPassToOutput;\nreturn msg;\n","outputs":1,"noerr":0,"x":586.5,"y":1392,"wires":[["17002173.fb92b7","e9a41a2c.07407"]]},{"id":"9fe13a60.dd5c88","type":"ProfilesOut","z":"ecd07fb1.a3fa8","server":"332513a5.aa7754","status":"Hello from Node-RED :) (payload = %s)","target":"myboard","targetValue":"@me","x":954.5,"y":1390,"wires":[["5d96bd1e.59ce24","5f0077a6.e65db8","a20a20ae.f329b"]]},{"id":"ed8030c2.b524f8","type":"comment","z":"ecd07fb1.a3fa8","name":"The search string (open for details)","info":"The search should be in the format shown here: \n\nsimple test would be \"search=db2&ps=200\" (search for the keyword \"db2\" and return 200 results)\n\nhttps://www-10.lotus.com/ldd/lcwiki.nsf/xpAPIViewer.xsp?lookupName=IBM+Connections+5.5+API+Documentation#action=openDocument&res_title=Searching_Profiles_programmatically_ic55&content=apicontent\n\nthe \"ps=x\" on the end of the query defines how many resut are returned.\n","x":192.5,"y":176,"wires":[]},{"id":"6db74dfd.3aca44","type":"comment","z":"ecd07fb1.a3fa8","name":"List of users needs to be supplied here in the txt file","info":"","x":1004.5,"y":848,"wires":[]},{"id":"8ff81dc9.f48a98","type":"comment","z":"ecd07fb1.a3fa8","name":"Need to consider what to do if we have already posted to a user","info":"","x":335.5,"y":278,"wires":[]},{"id":"fc98ca7a.c45a2","type":"file in","z":"ecd07fb1.a3fa8","name":"List Of Team Member's IDs","filename":"/Users/tim/Desktop/teammembers.txt","format":"utf8","x":935,"y":935,"wires":[["d1f5ceee.d6c05","e545e14a.8d0af"]]},{"id":"d1f5ceee.d6c05","type":"function","z":"ecd07fb1.a3fa8","name":"Check for Match","func":"var arrayOfTextEntries = msg.payload.split(\";\");\nvar entryToLookFor = msg.entryToLookFor;\nif (arrayOfTextEntries.indexOf(entryToLookFor)>=1){\n    msg.found = true;\n    msg.dataToPassThrough = msg.dataToPassThrough;\n} else {\n    msg.found = false;\n    msg.dataToPassThrough = null;\n}\nreturn msg;","outputs":1,"noerr":0,"x":908,"y":1084,"wires":[["4ebeb8d4.c8cc","b0a4a513.39812","a340beb7.7e03e"]]},{"id":"975fe5e6.19e4d","type":"function","z":"ecd07fb1.a3fa8","name":"Format input msg","func":"msg.entryToLookFor = msg.targetValue;\nmsg.dataToPassToOutput = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":627,"y":934,"wires":[["fc98ca7a.c45a2"]]},{"id":"4ebeb8d4.c8cc","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"found","x":1190,"y":1085,"wires":[]},{"id":"e545e14a.8d0af","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"false","x":1191,"y":935,"wires":[]},{"id":"4db55f3a.997ef8","type":"comment","z":"ecd07fb1.a3fa8","name":"A simple passthrough filter with a text file filter list","info":"","x":315.5,"y":869,"wires":[]},{"id":"8ce94f9d.1a343","type":"comment","z":"ecd07fb1.a3fa8","name":"Output the contents of the file for testing purposes","info":"So that we can check we have found the file and what it contains","x":1308.5,"y":890,"wires":[]},{"id":"d63e885a.c2d258","type":"comment","z":"ecd07fb1.a3fa8","name":"Have we found the string in the file?","info":"","x":1262.5,"y":1049,"wires":[]},{"id":"17321c4f.2796cc","type":"comment","z":"ecd07fb1.a3fa8","name":"Full path to your text file","info":"eg /Users/tim/Desktop/teammembers.txt\n\nThis flow is written to accept a text file \nwith entries separated by semi-colons eg.\n\ncf8903hjk-fdjsk-fds-4324-dfdsfd;ghsds-5325-fdsf-4332;jkl34-5435f-432413-gfdg-44f;\n\nThe separator is defined and can be changed in the split function within the Check for Match function","x":925.5,"y":892,"wires":[]},{"id":"4be59ae.344d2e4","type":"comment","z":"ecd07fb1.a3fa8","name":"Convert the string returned by the file node to an array and check if msg.entryToLookFor is in that array","info":"","x":1170.5,"y":1128,"wires":[]},{"id":"b0a4a513.39812","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"dataToPassToOutput","x":1234.5,"y":1171,"wires":[]},{"id":"148b58b4.216677","type":"comment","z":"ecd07fb1.a3fa8","name":"The message will only pass through to here if msg.found = true","info":"","x":1355.5,"y":1216,"wires":[]},{"id":"ebc09d78.2651a","type":"inject","z":"ecd07fb1.a3fa8","name":"Simulate Input","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":394.5,"y":934,"wires":[["975fe5e6.19e4d"]]},{"id":"4027afe7.ffc17","type":"comment","z":"ecd07fb1.a3fa8","name":"Flow Summary","info":"If msg.entryToCheckFor exists in the \ntext file then msg.dataToPassThrough is \npassed through to the output of the flow ","x":615.5,"y":980,"wires":[]},{"id":"17002173.fb92b7","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"false","x":871.5,"y":1470,"wires":[]},{"id":"e9a41a2c.07407","type":"debug","z":"ecd07fb1.a3fa8","name":"","active":true,"console":"false","complete":"targetValue","x":881.5,"y":1518,"wires":[]},{"id":"60d58daf.d3069c","type":"comment","z":"ecd07fb1.a3fa8","name":"This is where you set what to post to the user","info":"","x":848.5,"y":710,"wires":[]},{"id":"529cfae2.f3422c","type":"comment","z":"ecd07fb1.a3fa8","name":"Ensure you perform adequate testing before connecting these nodes because you could flood your users with posts!","info":"","x":1120.5,"y":1319,"wires":[]},{"id":"332513a5.aa7754","type":"ICLogin","z":"","serverType":"onpremises","cloudServer":"europe","server":"https://w3-connections.ibm.com"}]

Flow Info

Created 7 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x15)
  • debug (x16)
  • file in (x1)
  • function (x6)
  • inject (x2)
  • json (x1)
Other

Tags

  • ibmconnections
  • posting
  • social
  • team
  • IBM
  • connections
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option