I’m running into an issue where I want to insert lines such as image: or actions: based upon whether fields are filled in or not. There is the option of doing this through many many choose options but if there’s a way to make it significantly cleaner I’d like to do it that way with a single notification action. I’ve tried templating without success. Is there a good way to do this?
What I’m after is this:
data:
message: "{{message}}"
title: "{{title}}"
data:
icon: "{{icon}}"
color: "{{icon_color_input}}"
sticky: "{{ sticky_notification }}"
image: /media/local/cameras/latest.jpg # This should only appear if field camera_image is defined
actions: # This should only appear if field option_1_action is defined
- action: "{{option_1_action}}" # This line should only appear if field option_1_action is defined
title: "{{option_1_title}}" # This line should only appear if field option_1_title is defined
uri: "{{ option_1_link }}" # This line should only appear if field option_1_link is defined
- action: "{{option_2_action}}" # This line should only appear if field option_2_action is defined
title: "{{option_2_title}}" # This line should only appear if field option_2_title is defined
uri: "{{option_2_link}}" # This line should only appear if field option_1_link is defined