Skip to content

Commit 6a03434

Browse files
committed
add warning for slack setup using classic apps + RTM
prints warining on bridge startup put it in the same place as the very legacy webhook setup instead
1 parent a3fa341 commit 6a03434

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

bridge/slack/slack.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,23 @@ const (
8181
)
8282

8383
func New(cfg *bridge.Config) bridge.Bridger {
84-
// Print a deprecation warning for legacy non-bot tokens (#527).
8584
token := cfg.GetString(tokenConfig)
85+
appToken := cfg.GetString(appTokenConfig)
86+
if appToken != "" && !strings.HasPrefix(appToken, "xapp-") {
87+
cfg.Log.Error("App token missing `xapp-` prefix")
88+
}
89+
// Print a deprecation warning for legacy non-bot tokens (#527).
8690
if token != "" && !strings.HasPrefix(token, "xoxb") {
8791
cfg.Log.Warn("Non-bot token detected. It is STRONGLY recommended to use a proper bot-token instead.")
8892
cfg.Log.Warn("Legacy tokens may be deprecated by Slack at short notice. See the Matterbridge GitHub wiki for a migration guide.")
8993
cfg.Log.Warn("See https://github.com/42wim/matterbridge/wiki/Slack-bot-setup")
9094
return NewLegacy(cfg)
9195
}
92-
appToken := cfg.GetString(appTokenConfig)
93-
if appToken != "" && !strings.HasPrefix(appToken, "xapp-") {
94-
cfg.Log.Error("App token missing `xapp-` prefix")
96+
// print warning for RTM + classic slack apps setup
97+
if strings.HasPrefix(token, "xoxb-") && appToken == "" {
98+
cfg.Log.Warn("Bot token with classic Slack apps setup detected.")
99+
cfg.Log.Warn("It is recommended to use modern Slack apps with socket mode Events API instead.")
100+
cfg.Log.Warn("See https://github.com/matterbridge-org/matterbridge/blob/master/docs/protocols/slack/account.md")
95101
}
96102
return newBridge(cfg)
97103
}

0 commit comments

Comments
 (0)