Activity.From always returns the Bot user
See original GitHub issueVersion
4.8.0
Describe the bug
This is related to https://github.com/microsoft/BotFramework-Services/issues/208. Sorry if this is the wrong place to log this, but I can’t tell if the bug is in the Bot Service or in the Bot Framework.
I’ve been going through the code here and it seems this block should not work.
From = new ChannelAccount()
{
Id = slackEvent.BotId ?? slackEvent.UserId,
},
The SlackEvent.UserId
property is mapped to user_id
via [JsonProperty(PropertyName = "user_id")]
According to the Slack API, the user id is sent as part of the user
property of the event
payload, not user_id
.
So my question is, how would this ever work?
My assumption is that it works because Slack doesn’t post directly to my bot. It posts to slack.botframework.com/api/Events/abbot-bot
which does a bit of magic and then posts my bot running this code. That’s why I get something different from my user id in the From
property.
My question is where is the code that does this “magic”? I’m trying to understand where the bug is so I can fix my bot. Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (10 by maintainers)
Top GitHub Comments
Ah! That’s a big incentive to keep using the service. 😄
Thanks for all the info!
The activity protocol meaning that Activity format, along with a set of expected event types.
If you connect directly to Slack, via the adapter, you would get Activities with the key fields bound as expected, but the full message from slack in channelData. The event types may not all conform to the core protocol, because they will be slack event types.
There is not as far as I know a way to connect directly with Teams, as it connections to that API go through the channel service.
I’m not sure about service docs - I’ll do some research.
However, you can see the translation done in the dotnet package in this class: https://github.com/microsoft/botbuilder-dotnet/blob/master/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Slack/SlackHelper.cs