Skip to content

Add notifications to Slack App integration - Part 2

About

This issue is part of the epic &8670 (closed). See that epic for more context.

This issue is the next iteration of #372410 (closed). See that issue for more context.

In #372410 (closed) the posting of notifications to Slack was a no-op. This issue will implement the posting of notifications to Slack and release a new version of the Slack App.

Proposal

The Integrations::GitlabSlackApplication model will post to Slack using the slack_installation association's bot_access_token to the using the Slack API chat.postMessage method. This can be done by defining a #notify method that uses Slack::Api.post, handling the ArgumentError that method can throw.

The chat.postMesage API method would need the chat:write bot scope to be added to our GitLab Slack App in order to have permission to do this.

We should be able to post the same attachments and text params that Integrations::Slack (the legacy Slack Notifications integration) posts currently (see the Integrations::ChatMessage classes and #373321 (comment 1102940470)) to chat.postMessage, which means we can re-use the existing Integrations::ChatMessage classes.

We will release a new version of the GitLab Slack App in order to release the new chat:write bot scope. See our Slack dev guide.

The change should be behind the same feature flag as was used in #372410 (closed).

Documentation

We would update the documentation of the Slack Application page.

If needed, keep our Slack development guide information up to date.

Edited by Luke Duncalfe