Slack integration

If you're using Slack you can use the CommerceMind.Nexus.Slack NuGet package to get realtime updates when jobs and queues are failing. The package contains a IHealthCheckPublisher implementation that publishes health check failures to Slack.

Notifications

Queue errors:

"Show errors" button clicked:

Errors resolved:

Job errors:

"Show error logs" button clicked:

Installation

The first thing you need to do is to create a Slack app for your organization. Go to https://api.slack.com/apps and click Create New App.

You can use the following manifest to create the app from:

display_information:
  name: Nexus
  description: Info notices from Nexus
  background_color: "#18113f"
features:
  bot_user:
    display_name: Nexus
    always_online: false
oauth_config:
  scopes:
    bot:
      - chat:write.public
      - chat:write
settings:
  interactivity:
    is_enabled: true
  org_deploy_enabled: false
  socket_mode_enabled: true
  token_rotation_enabled: false

If you want to you can use our logo for the app icon: nexus.png

After you've created the app you need to install the CommerceMind.Nexus.Slack NuGet package and configure it in your Program.cs like this in the application that runs background jobs:

builder.Services.AddNexus().AddSlackPublisher(options =>
{
    options.AccessToken = "xoxb-XXX";
    options.AppToken = "xapp-XXX";
    options.ChannelId = "CXXX";
    options.AdminUIUrl = "https://url-to-nexus-adminui.com";
});

You should only enable the Slack publisher in the application that runs background functions and/or jobs. The Slack publisher can handle multiple instances/servers and will correctly handle instances starting and stopping, but if you run the publisher in an application that doesn't run jobs you won't get notified when jobs are failing.

You can find your Slack app access token in the left menu item OAuth & Permissions on the page for your app (https://api.slack.com/apps/). The value starts with xoxb.

The app token can be found under Settings / Basic Information -> App-Level Tokens. The value starts with xapp.

The channel id can be found by opening the channel/DM/group chat you want Nexus to post messages to and click on the name at the top. In the bottom of the About tab you find the channel id. Note that the channel id is not visible in the Slack mobile app.

The admin UI url doesn't have to be publically available. The Nexus Slack app use it to generate links that a Slack user can click on. All communication between Slack and Nexus is done over web sockets so your Nexus application doesn't have to be publically accessible.