Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slack param to disable link unfurling #242

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/services/slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The Slack notification service configuration includes following settings:
| `signingSecret` | False | `string` | | `8f742231b10e8888abcd99yyyzzz85a5` |
| `token` | **True** | `string` | The app's OAuth access token. | `xoxb-1234567890-1234567890123-5n38u5ed63fgzqlvuyxvxcx6` |
| `username` | False | `string` | The app username. | `argocd` |
| `disableUnfurl` | False | `bool` | Disable slack unfurling links in messages | `true` |

## Configuration

Expand Down
5 changes: 5 additions & 0 deletions pkg/services/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type SlackOptions struct {
Channels []string `json:"channels"`
InsecureSkipVerify bool `json:"insecureSkipVerify"`
ApiURL string `json:"apiURL"`
DisableUnfurl bool `json:"disableUnfurl"`
}

type slackService struct {
Expand Down Expand Up @@ -125,6 +126,10 @@ func buildMessageOptions(notification Notification, dest Destination, opts Slack
slackNotification = notification.Slack
}

if opts.DisableUnfurl {
msgOptions = append(msgOptions, slack.MsgOptionDisableLinkUnfurl(), slack.MsgOptionDisableMediaUnfurl())
}

return slackNotification, msgOptions, nil
}

Expand Down
Loading