Echo as Media Player - Text_Input to play song or artist

I am trying to use input_text on a card to then trigger an echo to pay a song or an artist. I have this in node red for now, but may just make an automation. I find easier to debug in node red. I cannot get the input text msg.payload into the json for the play_media service… I know it is something simple I am missing in the Function Node or how the JSON{} works… any help please

Blockquote
[{“id”:“2a9c9088.7baf1”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:“”},{“id”:“2a9d12ee.e7eb2e”,“type”:“api-call-service”,“z”:“2a9c9088.7baf1”,“name”:“Echo”,“server”:“2a12269e.94634a”,“service_domain”:“media_player”,“service”:“play_media”,“data”:“{"entity_id":"media_player.tap"}”,“mergecontext”:“”,“output_location”:“payload”,“output_location_type”:“msg”,“x”:970,“y”:100,“wires”:[]},{“id”:“8a7111b0.3f192”,“type”:“inject”,“z”:“2a9c9088.7baf1”,“name”:“”,“topic”:“”,“payload”:“On”,“payloadType”:“str”,“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“x”:130,“y”:100,“wires”:[[“29bf545.ecb0aac”]]},{“id”:“29bf545.ecb0aac”,“type”:“api-current-state”,“z”:“2a9c9088.7baf1”,“name”:“Music Text”,“server”:“2a12269e.94634a”,“outputs”:1,“halt_if”:“”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“override_topic”:false,“entity_id”:“input_text.music”,“state_type”:“str”,“state_location”:“payload”,“override_payload”:“msg”,“entity_location”:“data”,“override_data”:“msg”,“x”:310,“y”:100,“wires”:[[“ec76dac9.4c7dc8”]]},{“id”:“ec76dac9.4c7dc8”,“type”:“function”,“z”:“2a9c9088.7baf1”,“name”:“Format”,“func”:“var music = msg.payload \nvar message = ‘{"data": {"entity_id": "media_player.tap", "media_content_id":’ + music + ‘,"media_content_type": "AMAZON_MUSIC" }}’\n\nmsg.payload = message\n\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:520,“y”:100,“wires”:[[“2db4af87.8639d”]]},{“id”:“2db4af87.8639d”,“type”:“json”,“z”:“2a9c9088.7baf1”,“name”:“”,“property”:“payload”,“action”:“”,“pretty”:false,“x”:770,“y”:100,“wires”:[[“2a9d12ee.e7eb2e”]]},{“id”:“2a12269e.94634a”,“type”:“server”,“z”:“”,“name”:“Home Assistant1”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:false}]

here is my function:

var music = msg.payload
var message = ‘{“data”: {“entity_id”: “media_player.tap”, “media_content_id”:’ + music + ‘,“media_content_type”: “AMAZON_MUSIC” }}’

msg.payload = message

return msg;

where is there a post that shows how to post code?

Figured it out. I have an input_select for echo list and input_text for artist or song, and plays on the echo selected

still can’t figure out how to post code here.

Blockquote [{“id”:“2a9c9088.7baf1”,“type”:“tab”,“label”:“Music”,“disabled”:false,“info”:“”},{“id”:“2a9d12ee.e7eb2e”,“type”:“api-call-service”,“z”:“2a9c9088.7baf1”,“name”:“Echo”,“server”:“2a12269e.94634a”,“service_domain”:“media_player”,“service”:“play_media”,“data”:“{"entity_id":"media_player.tap"}”,“mergecontext”:“”,“output_location”:“payload”,“output_location_type”:“msg”,“x”:1090,“y”:100,“wires”:[]},{“id”:“29bf545.ecb0aac”,“type”:“api-current-state”,“z”:“2a9c9088.7baf1”,“name”:“Music Text”,“server”:“2a12269e.94634a”,“outputs”:1,“halt_if”:“”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“override_topic”:false,“entity_id”:“input_text.music”,“state_type”:“str”,“state_location”:“payload”,“override_payload”:“msg”,“entity_location”:“data”,“override_data”:“msg”,“x”:490,“y”:100,“wires”:[[“bf57347a.49bc78”]]},{“id”:“ec76dac9.4c7dc8”,“type”:“function”,“z”:“2a9c9088.7baf1”,“name”:“Format”,“func”:“var music = flow.get(‘musictxt’)\nvar echo = flow.get(‘echo_name’)\nvar entity = "media_player." + echo\nvar payload = {"data": {"entity_id": ${entity}, "media_content_id": ${music}, "media_content_type": "AMAZON_MUSIC" }}\n\nmsg.payload = payload\n\nreturn msg;\n\n\n”,“outputs”:1,“noerr”:0,“x”:900,“y”:100,“wires”:[[“2a9d12ee.e7eb2e”]]},{“id”:“bf57347a.49bc78”,“type”:“change”,“z”:“2a9c9088.7baf1”,“name”:“Music Text”,“rules”:[{“t”:“move”,“p”:“payload”,“pt”:“msg”,“to”:“musictxt”,“tot”:“flow”}],“action”:“”,“property”:“”,“from”:“”,“to”:“”,“reg”:false,“x”:690,“y”:100,“wires”:[[“ec76dac9.4c7dc8”]]},{“id”:“f01ba771.9f5938”,“type”:“server-state-changed”,“z”:“2a9c9088.7baf1”,“name”:“Echo”,“server”:“2a12269e.94634a”,“entityidfilter”:“input_select.echo”,“entityidfiltertype”:“exact”,“outputinitially”:false,“state_type”:“str”,“haltifstate”:“”,“halt_if_type”:“”,“halt_if_compare”:“is”,“outputs”:1,“output_only_on_state_change”:true,“x”:90,“y”:100,“wires”:[[“2a318c10.ed85a4”]]},{“id”:“2a318c10.ed85a4”,“type”:“change”,“z”:“2a9c9088.7baf1”,“name”:“Echo to Play”,“rules”:[{“t”:“move”,“p”:“payload”,“pt”:“msg”,“to”:“echo_name”,“tot”:“flow”}],“action”:“”,“property”:“”,“from”:“”,“to”:“”,“reg”:false,“x”:290,“y”:100,“wires”:[[“29bf545.ecb0aac”]]},{“id”:“2a12269e.94634a”,“type”:“server”,“z”:“”,“name”:“Home Assistant1”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:false}]