Skip to content

Notify_slack

lead2gold edited this page Mar 13, 2018 · 3 revisions

Slack Notifications

  • Source: https://slack.com/
  • Icon Support: Yes
  • Message Format: Markdown
  • Message Limit: 1000 Characters per message

Account Setup

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. When you've completed this process you will receive a URL that looks something like this: https://hooks.slack.com/services/T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7F

This effectively equates to: https://hooks.slack.com/services/{tokenA}/{tokenB}/{tokenC}

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:

  1. TokenA is T1JJ3T3L2
  2. TokenB is A1BRTD4JD
  3. TokenC is TIiajkdnlazkcOXrIdevi7F8

Syntax

Valid syntaxes are as follows:

  • 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}

Parameter Breakdown

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

Example

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
You can’t perform that action at this time.