diff --git a/source/_integrations/slack.markdown b/source/_integrations/slack.markdown index 046de9275af..a2867e109c8 100644 --- a/source/_integrations/slack.markdown +++ b/source/_integrations/slack.markdown @@ -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.