Setting up Slack notifications
Slack notifications are supported via webhooks. Webhooks are special URLs that Sourcegraph's Code Monitoring can call in order to send a message to a Slack channel when there are new search results for a query. In order to use Slack notifications, you must first create a Slack application in your organization's Slack workspace, add a webhook for a Slack channel within that application, and then configure a code monitor in Sourcegraph touse that webhook's URL.
- You must have the experimental feature flag
truein your Sourcegraph settings
- You must have permission to create apps inside of your organization's Slack workspace
Creating a Slack webhook
- Navigate to https://api.slack.com/apps and sign in to your Slack account if necessary.
- Click on the "Create an app" button.
- Create your app "From scratch".
- Give your app a name and select the workplace you want notifications sent to.
- Once your app is created, click on the "Incoming Webhooks" in the sidebar, under "Features".
- Click the toggle button to activate incoming webhooks.
- Scroll to the bottom of the page and click on "Add New Webhook to Workspace".
- Select the channel you want notifications sent to, then click on the "Allow" button.
- Your webhook URL is now created! Click the copy button to copy it to your clipboard.
Configuring a code monitor to send Slack notifications
- In Sourcegraph, click on the "Code Monitoring" nav item at the top of the page.
- Create a new code monitor or edit an existing monitor by clicking on the "Edit" button next to it.
- Go through the standard configuration steps for a code monitor and select action "Send Slack message to channel".
- Paste your webhook URL into the "Webhook URL" field.
- Click on the "Continue" button, and then the "Save" button.