I went down the rabbit hole of trying to send “fancy” notifications via Slack that were color-coded and formatted properly. The best I could find was this article that showed the format in JSON. The overall documentation for this was a bit spotty.
Basically, instead of something like this:
I wanted something like this:
Anyways, here’s what the configuration looks like in an automation:
action:
service: notify.default_alert
data_template:
message: ""
data:
attachments:
- color: >
#800040
title: >
Motion While Everyone Is Away.
text: |
Sensor: {{ trigger.to_state.attributes.friendly_name }}
Time: {{now().strftime("%c")}}
Along those same lines, I also wanted to send the occasional notification with a quick view from the front camera included. The documentation for this was a bit better, but I figured I’d share this too. I haven’t bothered flipping it over to the above format since I’m happy with the result.
- service: notify.default_alert
data_template:
title: >
Doorbell was pressed
message: >
Doorbell was pressed on {{now().strftime("%c")}}.
data:
file:
path: /home/homeassistant/.homeassistant/www/doorbell_01.gif
Hope this helps!