I know this seems like it's been asked before - but I understand that you can figure out that someone's talking on a Slack channel by inspecting activity.Conversation.IsGroup
- I'm using this successfully.
This is fine as long as the channel has more than two members! But there's an annoying edge case where newly-created channels, say, or channels just containing two members, have to experience the bot trying to respond to all messages there, until at least 3 members are added to the channel.
Has anyone figured out a handy way to detect this? I inspected the Activity
JSON for both a message to the app/bot user directly and a message to a channel, but there's no obvious way of being able to distinguish a channel message from a direct-to-bot-user message.
If I remember well, there is a difference in Slack in the naming between a channel and a direct messaging: this difference can be seen in the Conversation.Id
field:
Examples:
Bxxxxxxxx:Tyyyyyyyy:Czzzzzzzz
Bxxxxxxxx:Tyyyyyyyy:Daaaaaaaa
Bxxxxxxxx:Tyyyyyyyy:Gbbbbbbbb
Where:
Bxxxxxxxx
is your bot Slack's IDTyyyyyyyy
is your Slack's workspace IDCzzzzzzzz
is the current channel Slack's ID (visible in the url when using web version of Slack)You will be able to detect your case by checking the conversation ID