| 1 |
# Slack |
| 2 |
|
| 3 |
!!! attention "New URL format" |
| 4 |
The URL format for Slack has been changed to allow for API- as well as webhook tokens. |
| 5 |
Using the old format (`slack://xxxx/yyyy/zzzz`) will still work as before and will automatically be upgraded to |
| 6 |
the new format when used. |
| 7 |
|
| 8 |
The Slack notification service uses either [Slack Webhooks](https://api.slack.com/messaging/webhooks) or the |
| 9 |
[Bot API](https://api.slack.com/methods/chat.postMessage) to send messages. |
| 10 |
|
| 11 |
See the [guides](../../../guides/slack/index.md) for information on how to get your *token*. |
| 12 |
|
| 13 |
## URL Format |
| 14 |
|
| 15 |
!!! note "" |
| 16 |
Note that the token uses a prefix to determine the type, usually either `hook` (for webhooks) or `xoxb` (for bot API). |
| 17 |
|
| 18 |
--8<-- "docs/services/chat/slack/config.md" |
| 19 |
|
| 20 |
!!! info "Color format" |
| 21 |
The format for the `Color` prop follows the [Slack docs](https://api.slack.com/reference/messaging/attachments#fields) |
| 22 |
but `#` needs to be escaped as `%23` when passed in a URL. |
| 23 |
So <span style="background:#ff8000;width:.9em;height:.9em;display:inline-block;vertical-align:middle"></span><code>#ff8000</code> would be `%23ff8000` etc. |
| 24 |
|
| 25 |
## Getting the Channel ID |
| 26 |
|
| 27 |
!!! note |
| 28 |
Only needed for Bot API tokens. Use `webhook` as the channel for Webhook tokens. |
| 29 |
<!-- markdownlint-disable --> |
| 30 |
1. In the channel you wish to post to, open **Channel Details** by clicking on the channel title. |
| 31 |
<figure><img alt="Opening channel details screenshot" src="../../../guides/slack/app-api-select-channel.png" height="270" /></figure> |
| 32 |
|
| 33 |
2. Copy the Channel ID from the bottom of the popup and append it to your Shoutrrr URL. |
| 34 |
<figure><img alt="Copy channel ID screenshot" src="../../../guides/slack/app-api-channel-details-id.png" height="99" /></figure> |
| 35 |
<!-- markdownlint-restore --> |
| 36 |
|
| 37 |
## Examples |
| 38 |
|
| 39 |
!!! example "Bot API" |
| 40 |
```uri |
| 41 |
slack://xoxb:123456789012-1234567890123-4mt0t4l1YL3g1T5L4cK70k3N@C001CH4NN3L?color=good&title=Great+News&icon=man-scientist&botname=Shoutrrrbot |
| 42 |
``` |
| 43 |
|
| 44 |
!!! example "Webhook" |
| 45 |
```uri |
| 46 |
slack://hook:WNA3PBYV6-F20DUQND3RQ-Webc4MAvoacrpPakR8phF0zi@webhook?color=good&title=Great+News&icon=man-scientist&botname=Shoutrrrbot |
| 47 |
``` |