Skip to content

Commit

Permalink
Send monitoring alerts to Slack
Browse files Browse the repository at this point in the history
  • Loading branch information
saliceti committed Aug 29, 2023
1 parent 5f40ad8 commit 11132f0
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions source/infrastructure/monitoring/slack/index.html.md.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Slack
hide_in_navigation: true
link_in_toc: true
---
[Back to Monitoring](/infrastructure/monitoring/)

# <%= current_page.data.title %>

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](https://ukgovernmentdfe.slack.com/)
1. Click "Create an account"
1. Enter your email address
1. Confirm your email address and follow the instructions

## Create a Slack app

1. Navigate to [Your apps](https://api.slack.com/apps)
1. Click "Create New App"
1. Select "From scratch"
1. App name: `<Name of the service> <optional identifier>`
1. Worskspace: "Department for Education"
1. Click "Create app"
1. Click "Collaborators"
1. Add digital tools support engineers (ask in [Digital tools support](https://technical-guidance.education.gov.uk/infrastructure/support/#digital-tools-support))
1. Add other team members and managers

## Reques incoming webhook

1. Navigate to the app using the link generate above or access it via [Your apps](https://api.slack.com/apps)
1. Click "Incoming Webhooks"
1. On "Activate Incoming Webhooks", switch to "On"
1. Click "Request To Add New Webhook"
1. Fill in business justification
1. 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"
1. Select the channel
1. 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
- Ideally store the webhook as a [secret in keyvault](/infrastructure/security/managing-secrets/).
- Retrieve the secret with [the az cli action](https://github.com/marketplace/actions/azure-cli-action)
- Use a Github actions like [action-slack-notify](https://github.com/rtCamp/action-slack-notify) to post the message to the channel

0 comments on commit 11132f0

Please sign in to comment.