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:
jsuar 2025-02-09 17:47:44 -05:00 committed by GitHub
parent dcfd2efbbe
commit ff64cb6490
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.