Skip to content

CrumpledDog/Umbraco-HealthCheckSlackNotificationMethod

Repository files navigation

Umbraco Slack Health Check Notification v4 for Umbraco v10, v11, v12, v13 & v14

Icon

This package adds a Health Check Slack Notification Method to Umbraco v10, v11, v12, v13 & v14 so that the status of Health Checks can be posted to a specific Slack Channel.

If you are looking for earlier versions:

Installation

dotnet add package Our.Umbraco.HealthCheckSlackNotificationMethod  
NuGet Packages Version
Release NuGet download
Pre-release NuGet download

Once installed you will need to add settings into the appsettings.json file

Supported in v4.1+ Create a Slack App, once created go to "OAuth & Permissions" and add a "OAuth Scope" with the value "chat:write.customize" within the "Bot Token Scopes" section. If you will be posting to multiple channels from the same App, you may need to also add the "chat:write.public" scope. Copy the "Bot User OAuth Token" to the appsettings.json file.

Slack App

Or

You will need to create a Slack Incoming Webhook and copy the Webhook URL to the appsettings.json file.

Configuration

Edit appsettings.json to add the notification method and enable notifications. You need to replace the settings with your own web hook URL or OAuth Token and channel. Your settings file should look like the below:

  "Umbraco": {
    "CMS": {
      "Hosting": {
        "Debug": false
      },
      "Global": {
        "Id": "060fe809-7a36-4af6-a129-14582abc7058"
      },
      "HealthChecks": {
        "Notification": {
          "Enabled": true,
          "NotificationMethods": {
            "slack": {
              "Enabled": true,
              "Verbosity": "Detailed",
              "Settings": {
                "botUserOAuthToken": "xxxx-1111111111-11111111111-abcDEFGhIJ67890",
                "webHookUrl": "https://hooks.slack.com/services/xxxxxxxx/xxxxxxxx/xxxxxxxxx",
                "channel": "#test",
                "username": "Umbraco v10 Health Check Status"
              }
            }
          }
        }
      }
    }
  }

Example

Credits and references

This project includes Slack.Webhooks and SlackAPI both are MIT licensed.