IBM Cloud Docs
Configuring Slack

Configuring Slack

Slack is a cloud-based, real-time messaging and notification system.

You can now distribute event notifications by using the Event Notifications tool integration. IBM Cloud® Event Notifications is the preferred method for distributing notifications to Slack and other communication channels such as PagerDuty, email, SMS, push notifications, webhook, Microsoft® Teams, ServiceNow, and IBM Cloud Functions. For more information about using Event Notifications, see Enabling event notifications for toolchains.

Client bespoke toolchain events generated by the POST /toolchains/{toolchain_id}/events API are not sent to the Slack tool integration. Bespoke toolchain events are sent only to IBM Cloud® Event Notifications.

Slack provides persistent chat, which is a more interactive alternative to email for team collaboration. You can communicate with your team on a dedicated channel or on a set of channels that is directly related to your work. You can also share files and images through the channels or in direct messages between two or more people. The communications in direct messages and on channels are retained so that you can search them.

Notifications that are posted to public Slack channels are visible to everyone on the team. You are responsible for the content that you post.

Configure Slack to receive notifications about your toolchain from the tool integrations, such as test and deployment activities:

  1. If you are configuring this tool integration as you are creating the toolchain, in the Configurable Integrations section, click Slack.

  2. If you have a toolchain and are adding this tool integration to it, from the IBM Cloud console, click the menu icon hamburger icon and select DevOps. On the Toolchains page, click the toolchain to open its Overview page. Alternatively, on your app's Overview page, on the Continuous delivery card, click View toolchain. Then, click Overview.

    a. Click Add tool.

    b. In the Tool Integrations section, click Slack.

  3. Type the Slack webhook URL, which is generated by Slack as an incoming webhook. You need a Slack webhook URL for a Slack channel to receive notifications about your toolchain from the tool integrations. For instructions to create or find your webhook, see Incoming Webhooks.

If you use an API key for your Slack channel to receive notifications about your toolchain from the tool integrations, you must update your configuration to use a webhook instead.

  1. Type the name of the Slack channel that you want notifications to be sent to. The channel must exist and be active in your Slack team.

  2. Type the URL host name for your Slack team, which is the word or phrase before .slack.com in your team URL. For example, if your team URL is https://team.slack.com, the host name is team.

  3. Click Create Integration.

    If the Slack channel and team that you specified cannot be reached, the Setup Failed error is displayed on the Slack card. Hover over the Setup Failed message and click Reconfigure. Make sure that you are using valid configuration parameters for the Slack webhook URL, Slack channel, and URL host name for your Slack team. Update the settings as required, and click Save Integration.

  4. On your Toolchain's Overview page, on the Third-Party tools card, click Slack. You can view all of the activity for your toolchain in the configured Slack channel.

Configuring Slack by using the API

The Slack tool integration supports the following configuration parameters that you can use with the Toolchain HTTP API and SDKs when you create, read, and update tool integrations.

You must specify the tool_type_id property in the request body with the slack value.

Table 1. Slack tool integration parameters
Parameter Usage Type Terraform argument Description
api_token required, updatable Password webhook The incoming webhook that Slack uses to receive events. You can use a toolchain secrets reference for this parameter. For more information about secrets references, see Protecting your sensitive data in IBM Cloud.
channel_name required, updatable String channel_name The Slack channel to post notifications to.
pipeline_fail optional, updatable, Default: true Boolean pipeline_fail Generates pipeline failed notifications.
pipeline_start optional, updatable, Default: true Boolean pipeline_start Generates pipeline start notifications.
pipeline_success optional, updatable, Default: true Boolean pipeline_success Generates pipeline succeeded notifications.
team_url optional, updatable String team_name The Slack team name, which is the word or phrase before .slack.com in the team URL.
toolchain_bind optional, updatable, Default: true Boolean toolchain_bind Generates tool added to toolchain notifications.
toolchain_unbind optional, updatable, Default: true Boolean toolchain_unbind Generates tool removed from toolchain notifications.

Enabling Slack notifications for Tekton Pipelines

You can configure a Tekton Pipeline to send events to Slack integrations.

  1. From your toolchain's Overview page, on the Delivery pipelines card, click the Delivery Pipeline to open the Tekton Delivery Pipeline dashboard.
  2. On the Settings > Advanced Settings page, enable Event Notifications.
  3. Save your changes.