Skip to main content

The DfE technical guidance and its content is intended for internal use by the DfE community.

Back to Monitoring

Slack

Slack is a communication tool based on text chat. All stakeholders follow some channels and discuss in threads inside the channels. It’s convenient to send monitoring alerts to the channel as it has great visibility, it is received immediately and users can configure their own notifications.

Get a Slack account

If you don’t already have a Slack account, follow the process:

  1. Access the DfE Slack
  2. Click “Create an account”
  3. Enter your email address
  4. Confirm your email address and follow the instructions

Create a Slack app

  1. Navigate to Your apps
  2. Click “Create New App”
  3. Select “From scratch”
  4. App name: <Name of the service> <optional identifier>
  5. Worskspace: “Department for Education”
  6. Click “Create app”
  7. Click “Collaborators”
  8. Add digital tools support engineers (ask in Digital tools support)
  9. Add other team members and managers

Request incoming webhook

  1. Navigate to the app using the link generate above or access it via Your apps
  2. Click “Incoming Webhooks”
  3. On “Activate Incoming Webhooks”, switch to “On”
  4. Click “Request To Add New Webhook”
  5. Fill in business justification
  6. Wait for Digital tools support to approve the request

Create new webhooks

Onve authorised, it is possible to create multiple webhooks for the same app, and point them to different channels.

  1. Click “Add New Webhook to Workspace”
  2. Select the channel
  3. The webhook is created and you can copy the unique link

Use the webhook

Local test

Test manually using the curl command shown on the “Incoming webhooks” page

Gihub actions

  - uses: Azure/login@v1
    with:
      creds: ${{ secrets.AZURE_CREDENTIALS }}
  - name: Retrieve Slack Webhook from key vault
    uses: azure/CLI@v1
    id: fetch-slack-webhook
    with:
      inlineScript: |
        SECRET_VALUE=$(az keyvault secret show --name "SLACK-WEBHOOK" --vault-name "${{ secrets.INFRA_KEY_VAULT}}" --query "value" -o tsv)
        echo "::add-mask::$SECRET_VALUE"
        echo "SLACK-WEBHOOK=$SECRET_VALUE" >> $GITHUB_OUTPUT
  - name: Slack Notification
    if: failure()
    uses: rtCamp/action-slack-notify@master
    env:
      SLACK_COLOR: '#ff0000'
      SLACK_TITLE: Failure to Build API
      SLACK_MESSAGE: The pipeline has failed to build the API image
      SLACK_WEBHOOK: "${{ steps.fetch-slack-webhook.outputs.SLACK-WEBHOOK }}"

Recover app

If all the app collaborators have left, the webhooks cannot be updated. It is required to recover the app to add a collaborator.

  1. Find an existing Slack notification from this app in the channel
  2. Hover and select “Configuration”. This takes you to the workspace configuration for this app. Take not of the URL
  3. Go to the #requests-slack channel
  4. Choose the “General Slack query” workflow
  5. Request to be added as a collaborator on the app, using the above URL. If digital tool support are not already collaborators, they may have to create a ticket with Slack support.