Teams communication to custom https endoint - microsoft-teams

I would like to know how does Team communicate with a custom https endpoint.
I am developping a bot using Teams Toolkit and I am trying to understand what commands does teamsfx in order to successfuly side load app on Teams.
When trying to run the default command of "dev:teamsfx" and building the package using the correct ngrok enpoint and then uploading that package on Teams, the bot does not receive any messages through the "api/messages" endpoint.
However, when i run the deugging tool in VS Code, everything works fine and we pin pointed that the part that we are missing to add is found inside of these commands :
Teams Toolkit executed commands
So i have 2 questions :
Where can i find documentation regarding the tasks that Teams Toolkit is running so that we can manually execute those commands?
Why does Teams not reach our "api/messages" endpoint when we ONLY run "dev:teamsfx" ? (The appPackage is correct with the right manifest)

To answer your two questions:
The documentation about using Teams Toolkit to debug you app is here. You can read the documentation to know the details about what Teams Toolkit does for you after you press F5. For bot, Teams Toolkit will register and configure the bot, see here for more details.
When you run dev:teamsfx, the bot service will start. However, you have not configured the bot messaging endpoint, this is why Teams does not reach api/messages. When you press F5, Teams Toolkit will automatically start ngrok to forward the local bot traffic to a public url, then use this url to configure the bot messaging endpoint, e.g. https://0556-2404-f801-9000-1a-6fea-00-690.ngrok.io/api/messages. If you want to use your own tunnelling tool instead of the default ngrok, you can follow this doc. By the way, you can manage the bot (that Teams Toolkit has created for you) in Bot Framework developer portal, https://dev.botframework.com/bots.

Related

Teams channel in Azure Bot Service not working

I created an Azure Bot Service. When I test the service using "Test in Web Chat" it works as expected. When I add the Web Chat channel and use the Web Chat URL, it works as expected.
However, when I add the Microsoft Teams channel, it does not work as I expected. The Health Status shows "Healthy" (in "Channels (Preview)") and "Running" (in "Channels"). When I select "Open in Teams", I am redirected to Teams, but I do not see the bot as a user/bot I can chat with. I watched a video showing just that behavior as I was expecting, but the link only opens my Teams. I only have one other user in Teams and that user shows up. No sign of the bot. What am I missing?
I tried using the "Get bot embed codes". I put in the URL for the Mstreams href and instead of sending me to the bot user as I expected, I am redirected to the other user on the account (not the bot). What am I missing?
I've tried this using the "Channels" and the "Channels (Preview)" sections with the same results.
If relevant, I am still in the trial period with Azure and have not upgraded, but nothing says this should be an issue.
From all I can tell, I'm logging into the Azure portal and the Bot Framework portal with the same account as my Teams account. I'm using latest updated version of Chrome.
I don't think free account has anything to do with this. But the fact that the " bot embed codes" lead you to a different user, may be a configuration issue. Read Create a bot and Test and debug your Microsoft Teams bot in the Microsoft Teams documents for more information.
If you have successfully deployed to teams channel (teams channel registration), as per docs Copy the https part of the code that is shown in the Get bot embed code dialog.
For example, https://teams.microsoft.com/l/chat/0/0?users=28:b8a22302e-9303-4e54-b348-343232
In the browser, paste this address and then choose the Microsoft Teams app (client or web) that you use to add the bot to Teams. You should be able to see the bot listed as a contact that you can send messages to and receives messages from in Microsoft Teams.
Alternately, In-order to test them in teams you need to take the app id from the Configuration page of the bot.
Once you search with the app ID in teams you would be able to see this bot as a contact in Microsoft Teams.
Refer:
Create a Teams app package and upload your app to the Teams client for testing. Learn how
Publish your bot as a Line of Business app in your organization's Teams Tenant App Catalog. Learn how
Publish your bot as an app in the Teams App store. Learn how
I think I have found the answer, though I'm still trying to retrace my steps to make sure this is accurate. I will update here if I find anything more of value.
Despite little/no documentation to this effect, bots apparently do not work in the free version of Teams. You have to at least:
create a developer version of Microsoft O365 (E5 license) (and go through all the rigamarole to get it setup properly)
add at least one more user to the organization
then open Teams
Then, I used the embed URL to get the bot to show up. (Again, the same process did not work with my free Teams account even with another user added to it).
For the record, I didn't need to change any admin settings once the three items above were completed.

Chat Bot is not working - HTTPS internal server error

I have created a sample Echo bot for testing i've followed the given instructions in the MS tutorial site.
Created a web app service
Downloaded the MS bot framework v4 SDK - Echo Bot
Got the Publishing profile
Published the bot using visual studio
tested the chat bot When i test my bot in Test in Web Chat option in bot channels registration.
before that i tested in bot framework emulator, it was working fine as expected.
I checked the microsoft appid and password, it is all fine.
what am i missing to look on. can anyone please guide me.
Finally I've found the issue, though it a minor mistake. I wanted to update it here since many new Azure Bot users might do this mistake like me.
It was due to the option which i selected in while doing the app registration, After selecting the third option for Who can use this application or access this API?
It always good to select Multitenant option to make the bot to work for everyone.
If your requirement is restricted to one particular tenant then you should select the first option. But it is not in my case.
Accounts in any organizational directory (Any Azure AD directory -
Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)

How to embedded Microsoft Bot Emulator on my website

I'm trying to have the bot emulator running on my website, so the user can add cards & contact and test it from the website.
The Emulator is built on the WebChat application/source code. WebChat is a directline client for the directline channel. The emulator is used for development and testing. You can use webchat as a way to test, but you're not going to get some of the tools/benefits you get from Emulator. You might be able to take the emulator source code and build what you need, but that seems like a lot of work for so little benefit.
Your bot code does not have to be hosted in Azure, but for the simplest setup, you should create a bot channels registration in Azure and use that. Configure that to set your endpoint to wherever your bot code is running and then use the webchat channel and client.

Is there any way to develop own Webchat instead of Microsoft Botframework-Webchat

I don't want to keep any dependency on Microsoft Botframework registration for Webchat. I have successfully deployed my Bot Code in Shared Server instead of AzurePortal, But to use the Webchat I have to register the Bot in AzurePortal.
My concern is to develop own Webchat which will directly communicate with the Bot API Endpoint.
Have anyone work on this situations.
To clarify, bots communicate via:
User interaction with DirectLine Client ->
DirectLine API receives data and sends to bot ->
Bot hosted anywhere receives message
WebChat is just a DirectLine client. If you want to build your own WebChat, you can clone the repo and build it yourself. Note, however, that all this does is make it so you can host your own webchat.js file.
I believe that what you're actually looking for is to build your own DirectLine API. The only way to do so, currently, is to develop it in Node with the offline-directline npm package. This is not an official Bot Framework package, but will accomplish what you need. To then use WebChat with offline-directline, you would just need to change domain property when rendering WebChat.

Bot Framework Emulator and Cortana userinfo

I'm trying to create a location aware Cortana skill and for that I need a bot that works with this.
However when trying to develop this bot with the bot framework emulator I'm having issues debugging the location aware part as I'm not getting the userinfo entity that Cortana should provide. Is this possible at all with the emulator as it does not seem possible to have Cortana connect to my Visual Studio debug session.
Currently the emulator does not provide any options to pass along entities and channelData with request such as user profile and contextual information as explained here.
You should be able to debug your Cortana Skill by using ngrok to create a tunneling to your localhost bot. After that, you should update the url of your bot in the BotFramework Dev portal.
Also, have in mind that for the skill to sync with Cortana, the test device must be logged in with the same Microsoft account used to create the skill (see Set up your Cortana skills development environment
As Ezequiel wrote, you have to debug your skill in Cortana and/or from your phone.
List of step are:
create your bot
configure it and obtain app id/password
config the permissions and user info you want to access
then enable the Cortana channel from the skill dashboard
provided all the relevant required info
you're good to go (if I didn't forget anything)
You log in with Cortana using the same email address you used to register your bot, at this point you're able to invoke your bot/skill using the invocation name. From your phone (I tried only on Android) you can do it just typing in Cortana (no need for voice).
Please, bear in mind when creating your bot that if you use a WORK account you will not be able to add Cortana as a channel to your bot; therefore, no Cortana Skill. Microsoft doesn't support it yet.

Resources