We accomodate Slack !variables like @here and @channel (Related: ), but @usergroups are currently unhandled. Should be simple. Creating stub to track for later.
Docs: https://api.slack.com/docs/message-formatting#variables
Probably added support for this (can't test it myself, needs a paid plan it seems?), please try the latest binaries at https://bintray.com/42wim/nightly/Matterbridge/v1.8.0-29-g0bc9c70#files
Also, there has been a lot of code refactoring, which could've triggered old bugs
Ah, pushed the new binaries (nice logs!), but seems it's still not working: https://imgur.com/JWuXypq
Hm.. i recalled how the old parsing worked, but I'll have to catch up on refactored code and see if i can make sense of what's happening. Thanks for trying @42wim!
EDIT: Can you re-open if it's still standing?
ok, so it seems that we should be working in replaceVariable not replaceMention groups show in UI as starting with "@", but they are actually "!" variables.
https://github.com/42wim/matterbridge/blob/master/bridge/slack/slack.go#L364
This regex seems to do the trick: <!((?:subteam\^)?[a-zA-Z0-9]+)(?:\|(.+?))?>
Can test it here with these strings:
https://regex101.com/
<!here>
<!channel|channel>
<!subteam^S012345|happy-peeps>
There are two captured groups, which represent "command" and "label". The Slack docs say "use the label when it's there, and otherwise fall back on command string" (for backward compat).
So in your screenshot there is no label ? so what should it return ? @subteam^S517M0H29 ?
Hm. I think that change in 0bc9c70 might have actually introduced a regression:

Going back to v1.8.0
So in your screenshot there is no label ? so what should it return ? @subteam^S517M0H29 ?
The groups won't ever exist across instances, so best to just copy to label from <!command|label> format and prefix it with "@".
Also, to clarify, the screenshots are not showing label because the existing replaceVariable command just pulls out the "command" portion of <!command|label> from the underlying markup going over the wire. This works fine for <!here|here> and <!channel|channel>, but not <!subteam^S517M0H29|steering-committee>
Not sure about the regression, but this should fix the original variable replacement
// @see https://api.slack.com/docs/message-formatting#variables
func (b *Bslack) replaceVariable(text string) string {
results := regexp.MustCompile(`<!((?:subteam\^)?[a-zA-Z0-9]+)(?:\|(.+?))?>`).FindAllStringSubmatch(text, -1)
for _, r := range results {
// pls doublecheck -- i don't know golang!
name, isset := r[2]
if !isset {
name = r[1]
}
text = strings.Replace(text, r[0], "@"+name, -1)
}
return text
}
@patcon can you test https://bintray.com/42wim/nightly/Matterbridge/v1.8.0-32-g79c4ad5#files ?
Unfortunately the regression still exists:

Confirmed that going back to v1.8.0 resolved
Logs: https://gist.github.com/patcon/1b2010f2266f098ef1881e4c41449560
Also, confirmed that usergroups are suffering same issue of identifier being used instead... hm..

I'll create a new ticket for regression, as I feel that will confuse this issue until resolved :)
Re: https://github.com/42wim/matterbridge/issues/384#issuecomment-370541059
Related to the extra "@" in the usergroup labels (which seems to be undocumented?), this regex should address it:
<!((?:subteam\^)?[a-zA-Z0-9]+)(?:\|@?(.+?))?>
Ok, thanks for looking into the regex so that I didn't have to :-)
The binary is building, will be in https://bintray.com/42wim/nightly/Matterbridge/v1.8.0-39-ab94b5c#files in a couple of minutes
Confirmed working great now :tada: