4.8.0
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!
Also, does Microsoft Bot Framework support connecting Slack directly to the bot? If so, that code snippet above would never work.
@haacked - if you use the Adapter, you would be talking directly to Slack with the bot. If you use the Azure channel service, there is a translation that occurs in Azure before the message arrives at your bot.
We'll be investigating this issue! Updates will be posted here.
We'll be investigating this issue! Updates will be posted here.
Thanks! Let me know if there's anything I can do to help. I am using Azure Channel Service.
Apologies if these questions seem naive. Still new to this and wrapping my head around it.
if you use the Adapter, you would be talking directly to Slack with the bot. If you use the Azure channel service, there is a translation that occurs in Azure before the message arrives at your bot.
I was under the impression I had to use Azure Bot Service in order to host my bot so that I would get this translation.
But as I understand it now, it would be possible for me to have Slack talk directly to the bot. Also, there's an adapter for Teams and other chat platforms. So one approach I could do is have all these chat platforms talk directly to my bot.
What benefit do I get from staying with the Azure Bot Service as an intermediary?
The service provides normalization of many events into the Bot Framework activity protocol, and allows you to connect to multiple different channels.
The adapters provide more direct access to the raw features of the platforms - they still do light translation of the format, but leave much of the incoming and outgoing data untouched. They are not 100% the same.
Thanks @benbrown!
The service provides normalization of many events into the Bot Framework activity protocol,
What exactly is the Bot Framework activity protocol? By this do you mean how the Activity object gets populated.
The adapters provide more direct access to the raw features of the platforms - they still do light translation of the format, but leave much of the incoming and outgoing data untouched. They are not 100% the same.
I see. So if I understand correctly, if I didn't use the service and connected directly to Slack and Teams, the Activity there might be some properties on Activity that are not populated and I would need to access ChannelData in more cases. Does that sound right?
Is there documentation on what translations are handled by the Bot Service somewhere?
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
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.
Ah! That's a big incentive to keep using the service. 馃槃
Thanks for all the info!
The ability to have your bot connected to multiple channels through one interface is great!
BTW, this issue seems to have resolved itself. I didn't make any code changes. Feel free to close this issue if you're done investigating it.
I'll go ahead and close this out. Let us know if it returns.