Alexa Actionable Notification trigger everything

How can i set a different action to each question?

Exaple:

Sun = below_horizon > Alexa ask "Do you want to hear a music?"
For this question, i want to call a service called script.spotify_alexa. ONLY he.

But this service is called with any question.

Btw, this is the code that i’m using in the flow:

[{"id":"a4033729.427c88","type":"tab","label":"Automações Alexa","disabled":false,"info":""},{"id":"847bd9e1.b28658","type":"server-state-changed","z":"a4033729.427c88","name":"Sol se pôs","server":"c6462e66.908a9","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":100,"wires":[["129f0d93.fc5752"]]},{"id":"db2f7dcb.b297e","type":"switch","z":"a4033729.427c88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"below_horizon","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":100,"wires":[["1fde1f19.d53c51"]]},{"id":"1fde1f19.d53c51","type":"api-call-service","z":"a4033729.427c88","name":"Aumentar volume","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.echo_dot_de_joao","data":"{\"volume_level\":\"0.25\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":100,"wires":[["faa6780a.0540f8","21bd80dc.64864"]]},{"id":"faa6780a.0540f8","type":"api-call-service","z":"a4033729.427c88","name":"Pergunta Alexa","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"boa_noite_alexa","data":"{\"text\":\"Boa noite, deseja ouvir uma musiquinha?\",\"alexa_device\":\"media_player.echo_dot_de_joao\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":860,"y":100,"wires":[[]]},{"id":"b4b7623f.c1b87","type":"api-call-service","z":"a4033729.427c88","name":"Diminuir volume","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.echo_dot_de_joao","data":"{\"volume_level\":\"0.15\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":260,"y":220,"wires":[["602a34a4.d20bbc"]]},{"id":"21bd80dc.64864","type":"api-call-service","z":"a4033729.427c88","name":"Ligar Fita LED","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.fita_led","data":"{\"transition\":\"10\",\"color_name\":\"green\",\"brightness\":\"255\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":160,"wires":[[]]},{"id":"737cbe42.b1db1","type":"api-call-service","z":"a4033729.427c88","name":"Spotify na Alexa","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"script","service":"spotify_alexa","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":180,"wires":[[]]},{"id":"602a34a4.d20bbc","type":"switch","z":"a4033729.427c88","name":"Opções","property":"payload.event.event_response","propertyType":"msg","rules":[{"t":"eq","v":"ResponseYes","vt":"str"},{"t":"eq","v":"ResponseNo","vt":"str"},{"t":"eq","v":"ResponseNone","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":430,"y":220,"wires":[["737cbe42.b1db1"],[],[]]},{"id":"4181317f.0ab51","type":"server-events","z":"a4033729.427c88","name":"Resposta","server":"ceea5ac5.1b1658","version":1,"event_type":"alexa_actionable_notification","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":100,"y":220,"wires":[["b4b7623f.c1b87"]]},{"id":"129f0d93.fc5752","type":"api-current-state","z":"a4033729.427c88","name":"Vitor está em casa?","server":"c6462e66.908a9","version":2,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.joao_vitor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":290,"y":100,"wires":[["db2f7dcb.b297e"],[]]},{"id":"f986d2c1.c04ea","type":"inject","z":"a4033729.427c88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":60,"wires":[["1fde1f19.d53c51"]]},{"id":"f4bfcf51.cf677","type":"api-call-service","z":"a4033729.427c88","name":"Pergunta Alexa","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"teste","data":"{\"text\":\"Teste... Teste.\",\"alexa_device\":\"media_player.echo_dot_de_joao\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":400,"y":500,"wires":[[]]},{"id":"65b5ffb7.d01db","type":"inject","z":"a4033729.427c88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":460,"wires":[["f4bfcf51.cf677"]]},{"id":"c6462e66.908a9","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"ceea5ac5.1b1658","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

You need to give your questions unique id’s and then in the response you need to have a switch node that has an output for each id

[{"id":"847bd9e1.b28658","type":"server-state-changed","z":"a4033729.427c88","name":"Sol se pôs","server":"c6462e66.908a9","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1800,"y":140,"wires":[["129f0d93.fc5752"]]},{"id":"db2f7dcb.b297e","type":"switch","z":"a4033729.427c88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"below_horizon","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2170,"y":140,"wires":[["1fde1f19.d53c51"]]},{"id":"1fde1f19.d53c51","type":"api-call-service","z":"a4033729.427c88","name":"Aumentar volume","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.echo_dot_de_joao","data":"{\"volume_level\":\"0.25\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2370,"y":140,"wires":[["21bd80dc.64864","f8943b5e571e096e"]]},{"id":"b4b7623f.c1b87","type":"api-call-service","z":"a4033729.427c88","name":"Diminuir volume","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.echo_dot_de_joao","data":"{\"volume_level\":\"0.15\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1980,"y":400,"wires":[["b5f3728663fc7aa7"]]},{"id":"21bd80dc.64864","type":"api-call-service","z":"a4033729.427c88","name":"Ligar Fita LED","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.fita_led","data":"{\"transition\":\"10\",\"color_name\":\"green\",\"brightness\":\"255\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2600,"y":180,"wires":[[]]},{"id":"737cbe42.b1db1","type":"api-call-service","z":"a4033729.427c88","name":"Spotify na Alexa","server":"c6462e66.908a9","version":3,"debugenabled":false,"service_domain":"script","service":"spotify_alexa","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2600,"y":300,"wires":[[]]},{"id":"602a34a4.d20bbc","type":"switch","z":"a4033729.427c88","name":"Opções","property":"payload.event.event_response","propertyType":"msg","rules":[{"t":"eq","v":"ResponseYes","vt":"str"},{"t":"eq","v":"ResponseNo","vt":"str"},{"t":"eq","v":"ResponseNone","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":2420,"y":340,"wires":[["737cbe42.b1db1"],[],[]]},{"id":"4181317f.0ab51","type":"server-events","z":"a4033729.427c88","name":"Resposta","server":"ceea5ac5.1b1658","version":1,"event_type":"alexa_actionable_notification","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":1800,"y":400,"wires":[["b4b7623f.c1b87"]]},{"id":"129f0d93.fc5752","type":"api-current-state","z":"a4033729.427c88","name":"Vitor está em casa?","server":"c6462e66.908a9","version":2,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.joao_vitor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1990,"y":140,"wires":[["db2f7dcb.b297e"],[]]},{"id":"f8943b5e571e096e","type":"api-call-service","z":"a4033729.427c88","name":"Alexa Actionable Notification - Music at Sundown","server":"fcbb557.4bc97a8","version":3,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"actionable_notification_play_music","data":"{\"text\":\"Boa noite, deseja ouvir uma musiquinha?\",\"event_id\":\"actionable_notification_play_music\",\"alexa_device\":\"media_player.echo_dot_de_joao\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2710,"y":120,"wires":[[]]},{"id":"b5f3728663fc7aa7","type":"switch","z":"a4033729.427c88","name":"Question Event_id's","property":"payload.event.event_id","propertyType":"msg","rules":[{"t":"eq","v":"actionable_notification_play_music","vt":"str"},{"t":"eq","v":"actionable_notification_vacuum","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":2200,"y":400,"wires":[["602a34a4.d20bbc"],["53434d42ed2f5f10"]]},{"id":"21d722e42d90879b","type":"api-call-service","z":"a4033729.427c88","name":"Clean House","server":"fcbb557.4bc97a8","version":3,"debugenabled":false,"service_domain":"vacuum","service":"send_command","entityId":"vacuum.alexa","data":"{\"command\":\"segmented_cleanup\",\"params\":{\"segment_ids\":[\"Living Room\",\"Laundry\",\"Kitchen\",\"Bathroom\",\"Bedroom\"]}}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2590,"y":420,"wires":[[]]},{"id":"53434d42ed2f5f10","type":"switch","z":"a4033729.427c88","name":"Opções","property":"payload.event.event_response","propertyType":"msg","rules":[{"t":"eq","v":"ResponseYes","vt":"str"},{"t":"eq","v":"ResponseNo","vt":"str"},{"t":"eq","v":"ResponseNone","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":2420,"y":460,"wires":[["21d722e42d90879b"],[],[]]},{"id":"bd3faeb41f13cfd2","type":"server-state-changed","z":"a4033729.427c88","name":"Alexa Alarm","server":"fcbb557.4bc97a8","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.living_room_echo_plus_next_alarm","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1810,"y":240,"wires":[["6b5a3779dea4c9f8"]]},{"id":"6b5a3779dea4c9f8","type":"function","z":"a4033729.427c88","name":"set time - offset","func":"varAlarmTime = msg.payload;\nmsg.payload = {};\nmsg.payload.ontime = varAlarmTime\nmsg.payload.offtime = varAlarmTime\nmsg.payload.onoffset = 45\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2000,"y":240,"wires":[["354f6de080a6b930"]]},{"id":"a68167d146c2ed4f","type":"change","z":"a4033729.427c88","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"True","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2400,"y":240,"wires":[["20aa91e89c4283d0"]]},{"id":"354f6de080a6b930","type":"schedex","z":"a4033729.427c88","name":"45min after Alarm","passthroughunhandled":false,"suspended":false,"lat":"-32.82752","lon":"151.35598","ontime":"","ontopic":"","onpayload":"on","onoffset":0,"onrandomoffset":0,"offtime":"","offtopic":"","offpayload":"","offoffset":"","offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":2190,"y":240,"wires":[["a68167d146c2ed4f"]]},{"id":"20aa91e89c4283d0","type":"api-call-service","z":"a4033729.427c88","name":"Alexa Actionable Notification - Start Vacuum","server":"fcbb557.4bc97a8","version":3,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"actionable_notification_vacuum","data":"{\"text\":\"Would you like me to start vacuum cleaning?\",\"event_id\":\"actionable_notification_vacuum\",\"alexa_device\":\"media_player.living_room_echo_plus\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2710,"y":240,"wires":[[]]},{"id":"c6462e66.908a9","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"ceea5ac5.1b1658","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"fcbb557.4bc97a8","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Thanks, but i already fixed the problem :smiley:

HI,

It used to work really well for me and Alexa was part of the family LOL ​​and now I have an API error
I have a few more that don’t work, how can I fix them? Is there an up-to-date guide