Skip to content

Getting Started with Slack Notification

Kasun Kodagoda edited this page Jul 30, 2017 · 2 revisions

Slack Notification task with advanced slack message customization for Visual Studio Team Services. The task includes the ability to send optional attachments with the standard slack messages.

Using Slack Notification Task

Follow the instructions below to configure the Slack Notification task to send messages to a slack channel or a user.

Getting the Slack API Token

You will need to generate an API token and include it as a secure variable in Visual Studio Team Services build/release definition. You can generate the API token using the Slack Token Generator.

Add the Slack Notification Task

Install the Slack Notification task in to your Visual Studio Team Services account and Search for the task and add it to your build/release definition.

Add Slack Notification Task

Required Configuration

Send Slack Notification section contains some required configuration options.

Required Configuration

Required Configuration

  • Message Author: Text shown as the author of the message in Slack.
  • Channel: Channel or the User where the message is sent to. E.g. #general, @kasunk
  • Message: Text shown as the author of the message in Slack. Messages can be formatted similar to the markup formats used in Markdown
  • Slack API Token: Slack API Token generated from the Slack Token Generator. Save the token in a secure build variable.
  • Icon URL: (Optional) The icon that will be shown along side the message.

Attachment Options

Slack Notification task provides support for sending attachments along with the message. Sending attachments is optional. There are several configuration options provided, as described below.

Attachment Options

Attachment Options

  • Author Name: (Optional) Small text used to display the author's name.
  • Author Link: (Optional) A valid URL that will hyperlink the Author Name text mentioned above. Will only work if Author Name is present.
  • Title: (Optional) The Title is displayed as larger, bold text near the top of a message attachment.
  • Title Link: (Optional) A valid URL will hyperlink the Text mentioned above.
  • Attachment Pre-Text: (Optional) This is optional text that appears above the message attachment block.
  • Attachment Text: (Optional) This is the main text in a message attachment, and can contain Standard Slack Message Markup.
  • Border Color: (Optional) Color of the border along the left side of the message attachment. Value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0)
  • Image URL: (Optional) A valid URL to an image file that will be displayed inside a message attachment. Supports gif, jpeg, png, & bmp formats.
  • Footer Text: (Optional) Contextualize footer text for the attachment. Limited to 300 characters.
  • Footer Icon: (Optional) Publicly accessible URL string that render a small icon beside your footer text.

Sample Slack Message

The following is a sample slack message sent to the #general slack channel.

Sample Message