Transferring message to call service

I am trying to use the call service node from Node-red for the usage of the downloader tool
In principle, I am trying to send the exact phrase that the service requires.
if I use the node “As Is” with the exact phrase in the data field, it works perfectly.
I just can’t send it from another node as a message.

One limitation is that the service should work with a JSON format.

all tests I made when using a function failed.
which formula should I use to get the correct message? should I use the JSON tool in any case?

Many thanks

[{"id":"d5d5ef58.5fcdc","type":"debug","z":"6e6a4c10.f82724","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":4100,"wires":[]},{"id":"d47ece42.b6d7f","type":"api-call-service","z":"6e6a4c10.f82724","name":"","server":"28e4cbae.536664","version":1,"debugenabled":true,"service_domain":"downloader","service":"download_file","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":4100,"wires":[["d5d5ef58.5fcdc"]]},{"id":"ac52e8d4.dcc308","type":"function","z":"6e6a4c10.f82724","name":"","func":"\n// I need to transfer the following message : \n// {\"url\": \"https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg\"}\n\nmsg.payload.data= \"{\"+ \"\\\"url\\\"\"+\":\\\"\"+\"https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg\"+\"\\\"}\"\n\nreturn msg.data","outputs":1,"noerr":0,"x":250,"y":4100,"wires":[["d47ece42.b6d7f"]]},{"id":"3e721bb0.219ef4","type":"inject","z":"6e6a4c10.f82724","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":4100,"wires":[["ac52e8d4.dcc308"]]},{"id":"28e4cbae.536664","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

changing the function little bit worked when I tested. when you start with inject timestamp, msg.payload becomes a text, so you can’t add another object to it. msg.payload = {} line convert it to an object.
or simple you can start the inject with empty object {} and remove msg.payload = {} line from the function.
and finally, you need to return entire msg object, not only msg.data

thanks for that. tried and still not getting it working. what phrase should I use in the data of the call service node ? could you share the working flow?

Sorry I am not using the downloader perse, so I could only test if the message structure was ok. but based on the documentation, if you can pass the message to service call node with the following structure, it should work. in theory…
I will try to integrate downloader and test with my next restart… will try report back

Edit: below flow worked…

[{"id":"dfdb1c03.4df25","type":"debug","z":"8ad7a884.2c35b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":760,"wires":[]},{"id":"88e5e7a8.db8db8","type":"api-call-service","z":"8ad7a884.2c35b8","name":"","server":"e447d17a.16a64","version":1,"debugenabled":true,"service_domain":"downloader","service":"download_file","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":710,"y":760,"wires":[["dfdb1c03.4df25"]]},{"id":"50a5f60f.e5a638","type":"function","z":"8ad7a884.2c35b8","name":"","func":"\n// I need to transfer the following message : \n// {\"url\": \"https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg\"}\n\nmsg.payload.data= {\"url\":\"https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg\"}\n\nreturn msg","outputs":1,"noerr":0,"x":470,"y":760,"wires":[["88e5e7a8.db8db8"]]},{"id":"fe45384c.0c4678","type":"inject","z":"8ad7a884.2c35b8","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":760,"wires":[["50a5f60f.e5a638"]]},{"id":"e447d17a.16a64","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

Unfortunately, this does not work with the downloader service.
the object is transferred is
url: “https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg

in the home assistant service ( and also in the standalone service node ( the url should be with parentheses :
“url”: “https://upload.wikimedia.org/wikipedia/en/b/be/The_Beatles_1_album_cover.jpg

strange, i just tried again and i was able to download the file. can you post your flow here one more time?

No need.
Copied your flow again but this time reconfigured the call service . works very nice.
Thanks so much !!:
:+1: