microsoft / botbuilder-python

The Microsoft Bot Framework provides what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.
http://botframework.com
MIT License
695 stars 279 forks source link

Fix and complete the example of the README file #604

Closed pesarkhobeee closed 4 years ago

pesarkhobeee commented 4 years ago

Is your feature request related to a problem? Please describe. The Readme file of the Microsoft Bot Framework Connector for Python has a wrong example, you can not find MicrosoftTokenAuthentication anywhere!

Describe the solution you'd like It seems you should use MicrosoftAppCredentials instead but also the example itself is not working anymore, so, it seems we need a correct and better example there and my suggestion is an example which can initial and send a message to a channel, it could be really useful and there big lack in that section in the examples.

v-kydela commented 4 years ago

@pesarkhobeee - Thanks for reporting this. I've updated the readme file. If you use correctly-formatted Slack ID's (:) the sample should work now.

The readme files aren't really where you should be getting your samples from, though. The samples repo now has a full set of Python samples.

pesarkhobeee commented 4 years ago

Thanks @v-kydela but the idea behind of that sample is how to send a message to a channel and you can not find it anywhere else, also the sample itself seems not to be correct any more too and I am trying to get a working example in this issue: [Python][Teams] Provide a sample that shows how to send a message to a channel

v-kydela commented 4 years ago

@pesarkhobeee - I think there might be some confusion here. A "channel" in the Bot Framework is one of several messaging platforms that the Azure Bot Service supports with its channel connector services. Direct Line, Microsoft Teams, Facebook Messenger, Slack, and Telegram are all examples of channels in this sense, and you could call them "bot channels." Microsoft Teams itself also has its own concept of channels, where a channel is a specific group conversation that a specific team has access to. (A Teams channel is like a channel on Discord if you're familiar with that.)

So the sample you've selected in that readme file you've found does indeed send a message to a channel, but the point is that all it's supposed to do is demonstrate how to use the botframework-connector library on its own. You only need to do this if you're trying to send a proactive message and therefore don't have a turn context.

Can you have a look at my PR and explain what you mean when you say it's not correct anymore?

pesarkhobeee commented 4 years ago

@v-kydela Thanks for your detailed description, now I can see it was my confusion, I don't know if it is applied to other channels or not but for sending a proactive message to a user in MS TEAMS you have to add tenant_id=TENANT_ID too otherwise the example is not working, just look at below pictures:

Screenshot from 2020-01-16 10-26-06

Screenshot from 2020-01-16 10-31-27

So yes, from my point of view that example is not correct but maybe it works with other types of channels like Slack. Also, I was dreaming if somebody can help me in sending a message to a Teams channel which as you said is a specific group conversation that a specific team has access to. Even I send a question in Stackoverflow but sadly it seems there is no hope:

Screenshot from 2020-01-16 13-00-15

v-kydela commented 4 years ago

@pesarkhobeee - The example is correct because it uses Slack. Also, you'll just have to be patient with your Stack Overflow question. My coworkers are working on it.

pesarkhobeee commented 4 years ago

@v-kydela It is not about patience but about perseverance, I was thinking there should be some documentation which tells us the information of how we should initial ConversationParameters depend on channel type and our purpose but at least I couldn't find it :) by the way I really got lots of valuable information here from you and I am really grateful for that, thank you again

v-kydela commented 4 years ago

@pesarkhobeee - If you want to persevere then you can have a look at the Teams samples in other languages and apply them to Python. The Bot Builder SDK's are meant to all work the same way.

pesarkhobeee commented 4 years ago

@v-kydela that was exactly what I did and you can see I have tried to implement C# code in NodeJs and it didn't work again and gave me the same output: https://github.com/microsoft/BotBuilder-Samples/issues/2127

v-kydela commented 4 years ago

@pesarkhobeee - Okay, well hopefully you'll be able to get the help you need in one of your other issues. This issue will be closed when my PR is merged.