[{"id":"5894a44.f86d75c","type":"groov-read-ds","z":"459dfd6b.8cb174","dataStore":"64a7d751.184248","tagName":"Insert","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"","topicType":"none","name":"Insert Button","x":430,"y":380,"wires":[["f6219571.c104d8"]]},{"id":"39b50edf.5636c2","type":"inject","z":"459dfd6b.8cb174","name":"","topic":"","payload":"","payloadType":"date","repeat":"0.5","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":380,"wires":[["5894a44.f86d75c"]]},{"id":"f6219571.c104d8","type":"switch","z":"459dfd6b.8cb174","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":380,"wires":[["2a7369df.e20766"]]},{"id":"caba7616.c1a8b8","type":"function","z":"459dfd6b.8cb174","name":"Check ID format","func":"var abc = msg.payload;\n\nif (abc === \"\") {\n msg={payload:'Insert box cannot be empty'}\n return [msg, null];\n}else{\n //msg.payload = abc;\n return [null, msg];\n}\n","outputs":2,"noerr":0,"x":760,"y":420,"wires":[["afcd2d44.cfb29"],["fd50b011.26858"]]},{"id":"2a7369df.e20766","type":"groov-read-ds","z":"459dfd6b.8cb174","dataStore":"64a7d751.184248","tagName":"ChatID","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"","topicType":"none","name":"Read ChatID","x":750,"y":380,"wires":[["caba7616.c1a8b8"]]},{"id":"2211e786.8efe58","type":"debug","z":"459dfd6b.8cb174","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1350,"y":440,"wires":[]},{"id":"cbc67811.afc7b8","type":"file","z":"459dfd6b.8cb174","name":"","filename":"/home/dev/unsecured/RealData.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":940,"y":580,"wires":[["3aa8bafd.e8bc96"]]},{"id":"afcd2d44.cfb29","type":"groov-write-ds","z":"459dfd6b.8cb174","dataStore":"64a7d751.184248","tagName":"ShowText","tableStartIndex":"","value":"","valueType":"msg.payload","name":"","x":1200,"y":440,"wires":[["2211e786.8efe58"]]},{"id":"7d7075cc.e38c7c","type":"join","z":"459dfd6b.8cb174","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":730,"y":540,"wires":[["8062ba01.041d28"]]},{"id":"fd50b011.26858","type":"change","z":"459dfd6b.8cb174","name":"Read ChatID","rules":[{"t":"set","p":"ChatID","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":460,"wires":[["fa91d65f.6ff6f8"]]},{"id":"8062ba01.041d28","type":"function","z":"459dfd6b.8cb174","name":"Find match","func":"var arr = msg.payload;\nvar chatid = global.get(\"ChatID\");\n\nfor(count = 0; count < arr.length; count++)\n{\n if(arr[count] === chatid )\n {\n msg={payload:\"Chat ID already exists.\"};\n return [msg, null];\n }\n\n}\nmsg={payload:chatid}\nreturn [null, msg];","outputs":2,"noerr":0,"x":870,"y":540,"wires":[["afcd2d44.cfb29"],["cbc67811.afc7b8"]]},{"id":"fa91d65f.6ff6f8","type":"file in","z":"459dfd6b.8cb174","name":"","filename":"/home/dev/unsecured/RealData.txt","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":820,"y":500,"wires":[["7d7075cc.e38c7c"]]},{"id":"3aa8bafd.e8bc96","type":"function","z":"459dfd6b.8cb174","name":"","func":"var chatid = global.get(\"ChatID\");\nmsg={payload:chatid+\" has been added to the text file\"}\nreturn msg;","outputs":1,"noerr":0,"x":1150,"y":580,"wires":[["afcd2d44.cfb29"]]},{"id":"64a7d751.184248","type":"groov-data-store","z":"","project":"18830a55.119306","dsName":"Telegram ChatID"},{"id":"18830a55.119306","type":"groov-project","z":"","address":"Localhost"}]
Thanks for all the replies, I already figure it out how to do.