I wasnt familiar with those fs-ops nodes but I think the Json node wasnt needed after all
You original post was a little bit misleading because you said the payload was a string
So you are reading a folder and getting the most recent jpg file name
and you need to add that filename to a curl command ?
The exec node that you were using has an option to append a msg.payload
So in the preceding function prepare the parameters to append to the curl command
[{"id":"7dbdf6ef.a73868","type":"inject","z":"f9d7b0ee.037d2","name":"RootDir","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"/config/www/images","payloadType":"str","x":110,"y":100,"wires":[["6456763b.e07d78"]]},{"id":"ee6515ea.f968c8","type":"function","z":"f9d7b0ee.037d2","name":"Combine and sort","func":"var combined = [];\n\nfor (var i = 0; i < msg.files.length; i++) {\n var file = msg.files[i];\n var stat = msg.stats[i];\n \n combined.push({\n path: msg.payload,\n file,\n ...stat\n })\n}\n\ncombined.sort((a, b) => b.birthtimeMs - a.birthtimeMs);\n\nmsg.combined = combined;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":160,"wires":[["50034043.e2347","493c6290.125e14"]]},{"id":"50034043.e2347","type":"change","z":"f9d7b0ee.037d2","name":"payload combined","rules":[{"t":"set","p":"payload","pt":"msg","to":"combined[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":160,"wires":[["5c0992f4.93919c","ac191147.385c7"]]},{"id":"5c0992f4.93919c","type":"debug","z":"f9d7b0ee.037d2","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":100,"wires":[]},{"id":"d2d5deb5.84213","type":"debug","z":"f9d7b0ee.037d2","name":"4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":100,"wires":[]},{"id":"ac191147.385c7","type":"function","z":"f9d7b0ee.037d2","name":"","func":"\n// prepare curl parameters to append with msg.payload\n\nlet cmd = `-X POST -H \"Content-type:application/json\" -d '{\"text\":\"Es hat gerade geklingelt!\",\"attachments\":[{\"image_url\":\"http://192.168.0.8:8123/local/images/${msg.payload.file}\"}]}' http://192.168.147.155:3000/hooks/EBKNzvBtZbBtCCyRG/hTyvpugcp85dXnyuogm8XxD8GXH9bvEDimvdNZEyw3WCTibQ`\n\nmsg.payload = cmd\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1100,"y":160,"wires":[["d2d5deb5.84213","d78ea1d9.30681"]]},{"id":"d78ea1d9.30681","type":"exec","z":"f9d7b0ee.037d2","command":"curl","addpay":true,"append":"","useSpawn":"false","timer":"5","oldrc":false,"name":"CurlPostRocketChat","x":660,"y":340,"wires":[["bfe4d4bb.73804"],[],[]]},{"id":"35811671.90ebea","type":"fs-ops-stats","z":"f9d7b0ee.037d2","name":"","path":"payload","pathType":"msg","filename":"files","filenameType":"msg","stats":"stats","sizeType":"msg","x":400,"y":160,"wires":[["ee6515ea.f968c8","e85f98ed.d60d58"]]},{"id":"6456763b.e07d78","type":"fs-ops-dir","z":"f9d7b0ee.037d2","name":"","path":"payload","pathType":"msg","filter":"*.jpg","filterType":"str","dir":"files","dirType":"msg","x":240,"y":160,"wires":[["35811671.90ebea"]]},{"id":"e85f98ed.d60d58","type":"debug","z":"f9d7b0ee.037d2","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":100,"wires":[]},{"id":"493c6290.125e14","type":"debug","z":"f9d7b0ee.037d2","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":100,"wires":[]},{"id":"bfe4d4bb.73804","type":"debug","z":"f9d7b0ee.037d2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":320,"wires":[]}]