Set up a Slack integration

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.

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.

To open a Red Hat support case directly from the Hybrid Cloud Console:

  1. Click Help (the ? icon) to open the help panel.
  2. Select the My support cases tab.
  3. Click Open a support case and add information about the issue.

Configure incoming webhooks in Slack

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

Before you begin

  • 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 navigation panel, 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 navigation panel, click Install App.
    2. In the Install 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. Under Settings in the navigation panel, click Basic Information.
    2. Scroll down to Display Information.
    3. Edit your app name, description, icon, and background color as desired.
    4. Click Save Changes.
  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 Configure the Slack integration.

What to do next

Verify your integration:

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

Configure the Slack integration

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.

Before you begin

  • You are logged in to the Hybrid Cloud Console as an Organization Administrator or as a user with Notifications administrator permissions. For more information about setting up Notifications administrator permissions, see Control team access to notification settings in the notifications documentation.

Procedure

  1. If necessary, go to the Slack API web page and copy the webhook URL that you configured.
    Note
    See Configure 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. Optional: Associate events with the integration. Doing this automatically creates a behavior group.
    Note
    You can skip this step and associate the event types later.
    1. Select a product family, for example OpenShift, Red Hat Enterprise Linux, or Console.
    2. Select the event types you want your integration to react to and click Next.
  9. To enable the integration, review the integration details and click Submit.
  10. Refresh the Integrations page to show the Slack integration in the Integrations > Communications list. Under Last connection attempt, the status is Ready to show the connection can accept notifications from the Hybrid Cloud Console.

What to do next

Verify your configuration:

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.

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

Before you begin

  • You are logged in to the Hybrid Cloud Console as an Organization Administrator or as a user with Notifications administrator permissions. Note
    You cannot log in to the Hybrid Cloud Console with your email address unless your email address is the same as your Red Hat login. For more information, see ../get-started/access-hcc.dita#finding-login.
  • 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 appears on the Notifications > Configure Events page in the Behavior Groups tab.
    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

What to do next

Verify your integration:

  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 ../troubleshoot/troubleshoot-notif-failures.dita#proc-troubleshoot in the notifications documentation for more details.