Search

Chapter 3. Integrating Slack with the Hybrid Cloud Console

download PDF

You can configure the Hybrid Cloud Console to send event notifications to a Slack channel or directly to a user. The Slack integration supports events from all Hybrid Cloud Console services.

Note

The Slack integration in this example is configured for Red Hat Enterprise Linux. The integration also works with Red Hat OpenShift and Hybrid Cloud Console events.

The Slack integration uses incoming webhooks to receive event data. For more information about webhooks, see Sending messages using incoming webhooks in the Slack API documentation.

Contacting support

If you have any issues with the Hybrid Cloud Console integration with Slack, contact Red Hat for support. Slack will not provide troubleshooting. The Hybrid Cloud Console integration with Slack is fully supported by Red Hat.

You can open a Red Hat support case directly from the Hybrid Cloud Console by clicking Help > Open a support case, or view more options from Help > Support options.

3.1. Configuring incoming webhooks in Slack

To prepare Slack for integration with the Hybrid Cloud Console, you must configure incoming webhooks in Slack.

Prerequisites

  • You have owner or admin permissions to the Slack instance where you want to add incoming webhooks.
  • You have App Manager permissions to add Slack apps to a channel.
  • You have a Slack channel or user to receive notifications.

Procedure

  1. Create a Slack app:

    1. Go to the Slack API web page and click the Create your Slack app button. This opens the Create an app dialog.
    2. Select From scratch to use the Slack configuration UI to create your app.
    3. Enter a name for your app and select the workspace where you want to receive notifications.

      Note

      If you see a message that administrator approval is required, you can request approval in the next step.

    4. Click Create App to finish creating the Slack app.
  2. Enable incoming webhooks:

    1. Under the Features heading in the left navigation, click Incoming Webhooks.
    2. Toggle the Activate Incoming Webhooks switch to On.
    3. Click the Request to Add New Webhook button. If required, enter a message to your administrators to grant access to your app and click Submit Request. A success message confirms you have configured this correctly.
  3. Create an incoming webhook:

    1. Under Settings in the left navigation, click Basic Information.
    2. In the Install your app section, click the Install to Workspace button.
    3. Select the channel where you want your Slack app to post notifications, or select a user to send notifications to as direct messages.
    4. Click Allow to save changes.
  4. Optional: Configure how your Hybrid Cloud Console notifications appear in Slack:

    1. Scroll down to Display Information.
    2. Configure your app description, icon, and background color as desired.
  5. Copy the webhook URL:

    1. Under Features, click Incoming Webhooks.
    2. Click the Copy button next to the webhook URL. You will use the URL to set up the integration in the Hybrid Cloud Console in Section 3.2, “Configuring the Slack integration in the Red Hat Hybrid Cloud Console”.

Verification

  • Open the Slack channel or user you selected during configuration, and check for a message confirming you have added the integration.

Additional resources

3.2. Configuring the Slack integration in the Red Hat Hybrid Cloud Console

After you have configured an incoming webhook in Slack, you can configure the Hybrid Cloud Console to send event notifications to the Slack channel or user you configured.

Prerequisites

  • You have Organization Administrator or Notifications administrator permissions for the Red Hat Hybrid Cloud Console.

Procedure

  1. If necessary, go to the Slack API web page and copy the webhook URL that you configured.

    Note

    See Section 3.1, “Configuring incoming webhooks in Slack” for the steps to create a Slack webhook URL.

  2. In the Hybrid Cloud Console, navigate to Settings > Integrations.
  3. Select the Communications tab.
  4. Click Add integration.
  5. Select Slack as the integration type and click Next.
  6. Enter a name for the integration (for example, My Slack notifications).
  7. Paste the Slack webhook URL that you copied from Slack into the Workspace URL field and click Next.
  8. To enable the integration, review the integration details and click Submit.
  9. Refresh the integrations page to show the Slack integration in the list. Your Slack integration is now listed on the Integrations > Communications page. Under Last connection attempt, the status is Ready to show the connection can accept notifications from the Hybrid Cloud Console.

Verification

Create a test notification to confirm you have successfully connected Slack to the Hybrid Cloud Console:

  1. Next to your Slack integration on the Integrations > Communications page, click the options icon (⋮) and click Test.
  2. In the Integration Test screen, enter a message and click Send. If you leave the field empty, the Hybrid Cloud Console sends a default message.
  3. Open the Slack channel you configured and check for the message sent from the Hybrid Cloud Console.
  4. In the Hybrid Cloud Console, go to Notifications > Event Log and check that the Integration: Slack event is listed with a green label.

Additional resources

3.3. Creating the behavior group for the Slack integration

A behavior group defines which notifications will be sent to external services such as Slack when a specific event is received by the notifications service. You can link events from any Red Hat Hybrid Cloud Console service to your behavior group.

Prerequisites

  • You are logged in to the Hybrid Cloud Console as an Organization Administrator or as a user with Notifications administrator permissions.
  • You have configured the Slack integration.

Procedure

  1. In the Hybrid Cloud Console, navigate to Settings > Notifications.
  2. Under Notifications, select Configure Events.
  3. Select the application bundle tab you want to configure event notification behavior for: Red Hat Enterprise Linux, Console, or OpenShift.
  4. Click the Behavior Groups tab.
  5. Click Create new group to open the Create behavior group wizard.
  6. Enter a name for the behavior group and click Next.
  7. In the Actions and Recipients step, select Integration: Slack from the Actions drop-down list.
  8. From the Recipient drop-down list, select the name of the integration you created (for example, My Slack notifications) and click Next.

    img notif add slack recipient

  9. In the Associate event types step, select one or more events for which you want to send notifications (for example, Policies: Policy triggered) and click Next.
  10. Review your behavior group settings and click Finish. The new behavior group is listed on the Notifications page.

    Note

    You can create and edit multiple behavior groups to include any additional platforms that the notifications service supports.

  11. Select Settings > Integrations and click the Communications tab. When the Slack integration is ready to send events to Slack, the Last connection attempt column shows Ready. If the notification reached Slack successfully, the Last connection attempt column shows Success.

    img notif ready success

Verification

  1. Create an event that will trigger a Hybrid Cloud Console notification. For example, run insights-client on a system that will trigger a policy event.
  2. Wait a few minutes, and then navigate to Slack.
  3. In your Slack channel, check for notifications from the Hybrid Cloud Console.
  4. In the Hybrid Cloud Console, go to Settings > Notifications > Event Log and check for an event that shows the label Integration: Slack.

    • If the label is green, the notification succeeded.
    • If the label is red, the integration might need to be adjusted.
  5. If the integration is not working as expected, verify that the incoming webhook connector was properly created in Slack, and that the correct incoming webhook URL is added in the Hybrid Cloud Console integration configuration.

    Note

    See Troubleshooting notification failures with the event log and integration settings in the notifications documentation for more details.

3.4. Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.