-
-
Notifications
You must be signed in to change notification settings - Fork 436
Notify_slack
- Source: https://slack.com/
- Icon Support: Yes
- Message Format: Markdown
- Message Limit: 1000 Characters per message
Slack is slightly more complicated then some of the other notification services, so here is quick breakdown of what you need to know and do in order to send Notifications through it using this tool:
First off, Slack notifications require an incoming-webhook it can connect to.
- You can create this webhook from here. Just follow the wizard to pre-determine the channel(s) you want your message to broadcast to.
- Or you can create a Slack App here and associate it with one of your Slack Workspaces. From here there are just a few extra steps needed to get your webhook URL (all done through the App's configuration screen):
- You must Activate the Incoming Webhook Feature if not already.
- On this same configuration screen, you can create a webhook and assign it to a channel/user.
Regardless of what option you choose (above), both will result in giving you a webhook URL that looks something like this:
https://hooks.slack.com/services/T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7F
Apprise supports this URL as-is (as of v0.7.7), you no longer need to parse the URL any further. However there is slightly less overhead (internally) if you do.
This URL effectively equates to:
https://hooks.slack.com/services/{tokenA}/{tokenB}/{tokenC}
If you want to convert this to an Apprise URL, do the following: The last part of the URL you're given make up the 3 tokens you need to send notifications with It's very important to pay attention. In the above example the tokens are as follows:
-
TokenA is
T1JJ3T3L2
-
TokenB is
A1BRTD4JD
-
TokenC is
TIiajkdnlazkcOXrIdevi7F8
Valid syntaxes are as follows:
- slack://{tokenA}/{tokenB}/{tokenC}
- https://hooks.slack.com/services/**{tokenA}**/**{tokenB}**/**{tokenC}**
Now if you're using the legacy webhook method (and not going through the App), you're granted a bit more freedom. As a result, the following URLs will also work for you through Apprise:
- slack://{tokenA}/{tokenB}/{tokenC}/#{channel}
- slack://{tokenA}/{tokenB}/{tokenC}/#{channel1}/#{channel2}/#{channelN}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/#{channel}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/#{channel1}/#{channel2}/#{channelN}
If you know the Encoded-ID of the channel you wish to access, you can use the plus (+) symbol to identify these separately from channels in the url. Valid syntaxes are as follows:
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/+{encoded_id}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/+{encoded_id1}/+{encoded_id2}/+{encoded_id3}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/+{encoded_id}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/+{encoded_id1}/+{encoded_id2}/+{encoded_id3}
If you know the user_id you wish to transmit your slack notification to (instead of a channel), you can use the at symbol (@) to do this with. Valid syntaxes are as follows:
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id1}/@{user_id2}/@{user_id3}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id1}/@{user_id2}/@{user_id3}
You can freely mix and match all of the combinations in any order as well:
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id}/#{channel}/+{encoded_id}
- slack://{botname}@{tokenA}/{tokenB}/{tokenC}/@{user_id}/#{channel}/+{encoded_id}
Variable | Required | Description |
---|---|---|
tokenA | Yes | The first part of 3 tokens provided to you after creating a incoming-webhook |
tokenB | Yes | The second part of 3 tokens provided to you after creating a incoming-webhook |
tokenC | Yes | The last part of 3 tokens provided to you after creating a incoming-webhook |
channel | No | Channels must be prefixed with a hash tag #! You can specify as many channels as you want by delimiting each of them by a forward slash (/) in the url. |
encoded_id | No | Slack allows you to represent channels and private channels by an encoded_id. If you know what they are, you can use this instead of the channel to send your notifications to. All encoded_id's must be prefixed with a plus symbol +! |
user_id | No | Users must be prefixed with an at symbol @! You can specify as many users as you want by delimiting each of them by a forward slash (/) in the url. |
botname | No | Identify the name of the bot that should issue the message. If one isn't specified then the default is to just use your account (associated with the incoming-webhook). |
Send a slack notification to our channel #nuxref:
# Assuming our {tokenA} is T1JJ3T3L2
# Assuming our {tokenB} is A1BRTD4JD
# Assuming our {tokenC} is TIiajkdnlazkcOXrIdevi7F
# our channel nuxref is represented by #nuxref
apprise slack:///T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7F/#nuxref