question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Activity.From always returns the Bot user

See original GitHub issue

Version

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
haackedcommented, May 21, 2020

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!

1reaction
benbrowncommented, May 21, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Member.Activities always returns an empty list | discord.py
I'm trying to write a bot command to check the user's activities. However, it always returns an empty list. @bot.command async def status(ctx): ......
Read more >
Get Teams specific context for your bot
Get Teams specific context for your bot, fetch user profile, get single member, team's, ... For chats, the entire roster is always returned....
Read more >
Event-driven conversations and activity handlers - Bot ...
An activity handler is an event-driven way to organize the conversational logic for your bot. Each different type or subtype of activity ......
Read more >
botframework-activity.md
Software that sends and receives activities, and generates automated, semi-automated, or entirely manual responses. Bots have endpoints that are registered with ...
Read more >
View in progress activity details
Click Activity > In Progress; Select an ongoing automation. ... Click No, Cancel to return to the View activity in progress details page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found