I am struggling to get this to work. I want a templated way to update alexa actionable notification so that I can re-use the function and call service. I can not get the alexa actionable notification holder to format correctly. Instead of " it says “text”: is put “text”: "
Thanks for any help
var text = flow.get('text')
var event_id = flow.get('event_id')
var alexa_device = flow.get('alexa_device')
var final_msg = '{"text": "' + `${text}` + '", "event": ' + `${event_id}` + '"}'
msg.payload = final_msg
return msg
returns:
{"text": "Testing actionable notfication", "event": test_action"}
flow:
[{"id":"ac0d899887c95c4b","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"cc5dd35330622fb0","type":"change","z":"ac0d899887c95c4b","name":"Set Message Attributes","rules":[{"t":"set","p":"text","pt":"flow","to":"Testing actionable notfication","tot":"str"},{"t":"set","p":"event_id","pt":"flow","to":"test_action","tot":"str"},{"t":"set","p":"alexa_device","pt":"flow","to":"media_player.office_show","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":140,"wires":[["ec3f2f4a6c8d6084"]]},{"id":"1029fedf704ca12f","type":"debug","z":"ac0d899887c95c4b","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1020,"y":140,"wires":[]},{"id":"5058a0f98d00ebfa","type":"inject","z":"ac0d899887c95c4b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":70,"y":140,"wires":[["cc5dd35330622fb0"]]},{"id":"791ad27a5bb4ea99","type":"api-call-service","z":"ac0d899887c95c4b","name":"Set Text","server":"2a12269e.94634a","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.alexa_actionable_notification"],"data":"{\"value\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":780,"y":140,"wires":[["1029fedf704ca12f"]]},{"id":"ec3f2f4a6c8d6084","type":"function","z":"ac0d899887c95c4b","name":"Alexa Alert","func":"var text = flow.get('text')\nvar event_id = flow.get('event_id')\nvar alexa_device = flow.get('alexa_device') \n\nvar final_msg = '{\"text\": \"' + `${text}` + '\", \"event\": ' + `${event_id}` + '\"}'\n\nmsg.payload = final_msg\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":140,"wires":[["791ad27a5bb4ea99"]]},{"id":"2a12269e.94634a","type":"server","name":"Hingham Home","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]