Is there a way that the slack notifications can take advantage of using all the options in the native slack.
Its actually already supported, I just don’t think its documented.
- go to: <your_ha_server>:8123/dev-service
- Set “Domain” to “Notify”
- Set “Service” to whatever you named the slack integration
Under “Service Data” do something like
{
"message": "testing",
"target": "#notifications",
"data": {
"attachments": [
{
"color": "#36a64f",
"pretext": "Optional text that appears above the attachment block",
"title": "Slack API Documentation",
"title_link": "https://api.slack.com/",
"text": "Optional text that appears within the attachment",
"fields": [
{
"title": "Priority",
"value": "High",
"short": false
}
]
}
]
}
Basically anything in this doc https://api.slack.com/docs/message-attachments can be nested under “data -> attachments” in your payload I believe.
Note looks like you have to supply the “message” part or it won’t send.
2 Likes
I tried that already and couldn’t get it to fire properly.
Please show me some clue on how to integrate the fields into YAML. Somehow this breaks the config when un-commenting the comments.
Thanks.
- service: notify.slack
data_template:
message: ""
data:
attachments:
- color: >
danger
title: >
Bandbreiten-Warnung
text: |
Down: {{ states.sensor.fastcom_download.state }} mbps, Up: {{ states.sensor.speedtest_upload.state }} mbps
# fields:
# - title: Down
# value: {{ states.sensor.fastcom_download.state }}
# short: false
# - title: Up
# value: {{ states.sensor.speedtest_upload.state }}
# short: false