mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-24 01:37:23 +00:00
Add info about multiple targets support for Slack integration (#37371)
* Add info about multiple targets * Blank line before the list --------- Co-authored-by: John Suarez <suarezjg@gmail.com>
This commit is contained in:
parent
dcfd2efbbe
commit
ff64cb6490
@ -106,7 +106,7 @@ sequence:
|
||||
- action: notify.YOUR_SLACK_TEAM
|
||||
data:
|
||||
message: "Fallback Text"
|
||||
target: "#test-channel"
|
||||
target: "#test-channel" # Single channel target
|
||||
title: "Reminder"
|
||||
data:
|
||||
blocks:
|
||||
@ -122,6 +122,38 @@ Update the blocks array with valid Slack blocks. The easiest way to create this
|
||||
|
||||
Create a duplicate of this script to use for different messages, and different channels (the door was opened in #security, the light was left on on #lights, etc).
|
||||
|
||||
You can also send messages to multiple targets (channels and/or users) at once:
|
||||
|
||||
```yaml
|
||||
alias: "Notify: Multiple Targets Message"
|
||||
sequence:
|
||||
- action: notify.YOUR_SLACK_TEAM
|
||||
data:
|
||||
message: "Alert: Motion detected!"
|
||||
target:
|
||||
- "#security" # Channel by name
|
||||
- "C01234ABCD" # Channel by ID
|
||||
- "U5678EFGH" # Direct message to user by ID
|
||||
title: "Security Alert"
|
||||
data:
|
||||
blocks:
|
||||
- type: section
|
||||
text:
|
||||
type: mrkdwn
|
||||
text: "Motion detected in the backyard camera"
|
||||
```
|
||||
|
||||
### Target Types
|
||||
|
||||
The `target` field accepts either a single value or a list of values. Each target can be:
|
||||
|
||||
- A channel name with a `#` prefix (e.g., `#general`)
|
||||
- A channel name without the `#` prefix (e.g., `general`)
|
||||
- A channel ID (e.g., `C01234ABCD`)
|
||||
- A user ID for direct messages (e.g., `U5678EFGH`)
|
||||
|
||||
When sending files, make sure you have the proper permissions set up as described in the Setup section.
|
||||
|
||||
### Icons
|
||||
|
||||
Slack uses the standard emoji sets used [here](https://slack.com/intl/en-gb/help/articles/202931348-Use-emoji-and-reactions#add-emoji-to-your-messages). Alternatively a publicly accessible URL may be used.
|
||||
|
Loading…
x
Reference in New Issue
Block a user