I followed the instructions that were given in the online tutorial (Building a bot from 0 to 60), but the emulator doesn't work. It keeps on telling me "401 unauthorized". I looked online and some of you suggested that https should be used. However, when I did so the emulator displayed a message saying it cannot connect to a remote server. Some of you also suggested changing Appid to MicrosoftAppid and doing the same thing with the password, but again that didn't work. Some of you even suggested leaving both the Appid and password blank in both the emulator and Web.config and that didn't work as well.
Does anyone know how to fix this issue? (I also made sure that everything (like the port and my Appid and password) was written correctly, so there shouldn't be any syntax or user errors).
Thanks
If you are using v3.0.0, please note that there is currently an issue with authentication if you use node.js. The suggested workaround is to deactivate authentication by not handing over any appId and appPassword in your connector options in your bot and do not use any auth data in your emulator.
Also note as #Thegaram said that you use a matching emulator to the botbuilder version you use. If you have the v0/v1 of botbuilder, you should use the Bot Framework Emulator (v1), if v3+, then the Bot Framework Channel Emulator (v3+). They will have trouble connecting to mismatching versions.
Related
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)
I have my bot registered in dev.botframework.com. It is published, up and running well. I'm trying to integrate it on Microsoft Teams. For that, I need to create a manifest, which I'm doing using App Studio. When I arrive to the part of configuring the the bot endpoint on App Studio, App Studio says that I need to add teamsappstudio#microsoft.com to my bot, admin textbox in order for it to find my bot. Here's what it says that I should do:
So, I added teamsappstudio#microsoft.com to my bot as an admin as AppStudio says that I should do, but when I click "Setup" in the last part, it shows me the error: "We couldn't access your bot. Make sure you've added "teamsappstudio#microsoft.com" as an admin and try again".
I don't know what else to do!!
Help me with this one guys.
Thank you!
The of Teams App Studio that's live now has a bug - sometimes the email address we extract from your authentication token has uppercase characters. We assumed they were all lowercase but it's likely yours are not. We are changing the logic to ignore case so in a week or two it should work properly.
Sorry for the confusion and hassle.
I have a .NET Bot Framework bot created using the template and tested on other channels and in the dashboard.
I've added the Skype for Business channel and performed the PowerShell cmdlets for my tenant. However, I constantly get the reply "Error happened in contacting target user".
I looked in the Bot Framework Dashboard for issues, and the problem is that the Bot Framework is getting back a 401 Unauthorized from my code. Remember that this works fine in other channels.
Suspecting a problem with how Skype for Business passes (or doesn't pass) the authentication tokens I commented out the BotAuthentication decorator. Suddenly everything works fine. So I think there's a problem with the Skype for Business channel and how it passes the authentication credentials, as this situation clearly isn't ideal.
Just to answer my own question on this. The reason I was seeing this problem was because I did not have the latest version of Microsoft.Bot.Builder. I needed to be running 3.5+ and I wasn't. I've written it up here (along with instructions for updating the NuGet package if you need that): https://blog.thoughtstuff.co.uk/2017/06/how-to-enable-your-bot-framework-bot-on-skype-for-business-part-2-or-how-i-followed-the-instructions-and-it-worked/
I am working on Bot framework technology, recently Microsoft announced the new version (V3) of bot.
I was already developed bots using old version, now I am trying to upgrade my bots to newer version.
For that everything working fine but after published my bot into azure, then by using the publish URL I am trying to test in bot framework channel emulator (3.0.0.54) it gives always "500, internal server error".
But when I added skype channel to my bot then it will working fine.
Only the problem is when I am testing in bot framework channel emulator with Published URL of my bot application, then only I got the error as "Internal server error".
I think there may be problem with latest version bot framework channel emulator
Please download the file from https://ngrok.com/download
Unzip the file and use command prompt to run the below command
ngrok http -host-header=rewrite 9000
screenshot
As seen in screenshot copy Forwarding URL with https and paste it in Emulator url
Emulator port should be in 9000 and emulator Url should contain ngrok forwarding Https URL
Note :ngrok should be in running state .if your getting same 500 error while trying next time please start from step 1.
For more reference .https//docs.botframework.com/en-us/tools/bot-framework-emulator/#navtitle
I discovered that a single public method apart from Post in Controller makes Bot Framework throw 500 InternalServerError. Simply keep only private and public Post method in your Controller and that should fix it.
Druing the debugging, you just dont disable the appid and password, rather make them blank and rebuild the same , you will be able to debug via emulator
Keep like given below
Dont just disable the BotId,AppID, Password rather make them blank like given below
<add key="BotId" value="" />
<add key="MicrosoftAppId" value="" />
<add key="MicrosoftAppPassword" value="" />
ngrok solution did not work for me. I just commented the botAuthentication and then it worked for me locally.
//[BotAuthentication]
public class MessagesController : ApiController
{
They just released an updated version of the framework (3.0.1) that addressed a few issues introduced with 3.0.0. Try updating to 3.0.1 and see if that will solve your issue (it fixed mine).
source
You may also need to follow this tutorial and use ngrok to allow you to access your published chatbot from the emulator. There is a screenshot in that tutorial that shows the BotId being used in the emulator, its not required so you can omit it.
The developer posted an answer on this thread.
Basically you can type 'disable' to disable AppId/AppPassword
It seems that if you deploy your bot to the cloud and try to test it from the emulator it will give this error.
The emulator seemed to work in 2 cases:
1- Localhost with security disabled (remove appid and app password)
2- localhost with security enabled (add appid and app password)
both endpoints via http only because it's localhost. If you deploy to the cloud you can test it in the emulator available on the Bot Portal. Make sure the endpoint for the hosted bot is https enabled.
I followed the steps in this troubleshoot guide and it fixed it for me: https://learn.microsoft.com/en-us/bot-framework/troubleshoot-authentication-problems
I didn't understand what actually caused the problem though. What I noticed was: desktop emulator works with localhost only.
I started using Microsoft Bot Framework and followed step by step all tutorials.
I has been able to register a new bot and to deploy it working good with emulator, but except it nothing else works.
Test connection to your bot chat do not works despite I get answer from emulator and from all connected channels, that where created and registered properly I always get an Unauthorized response or something like that, anyway no response, so nothing works.
I tried with Twilio, Web Chat, Telegram (Skype auth is pending) getting always the same response.
As it seems I strictly followed the tutorials, is there something else to do or to be approved? Or just the service is still not working at 100% as too young?
Thanks
If you are using HTTP you need to disable basic auth because the connector won't send your appSecret in the clear.
The solution is to make sure you register as HTTPS, or if you need to use HTTP then disable the basic auth.
Took me a while to get it working locally too. Oddly for me it only works when those 'secret' fields are empty, as mentioned and running in debug.
Running without debugging seems to always result in a 401
Hi I was facing same problem to work bot locally in v3. I just made everything blank in web.config and it is working.
I solved the problem.
It was related to https. It's not well explained into tutorial but when you create and publish a service in Azure it is created as http://XXXXXXX.azurewebsites.net as shocased into tutorial, but it will not work as your service must run in https.
I so used https://startssl.com to create a free ssl certificate then turned on SSL into my Azure service so everything started working.
I've cleaned up the getting started with the following; hopefully it will make it clearer for the next person who uses it:
Click the “Register a Bot” button and fill out the form. Many of the fields on this form can be changed later. Use a the endpoint generated from your Azure deployment, and don’t forget that when using the Bot Application template you’ll need to extend the URL you pasted in with the path to the endpoint at /API/Messages. You should also prefix your URL with HTTPS instead of HTTP; Azure will take care of providing HTTPS support on your bot. Save your changes by hitting “Create” at the bottom of the form.
Make sure you are using HTTPS. BotFramework will not work with basic auth so tokens are not passed in the clear.
See: http://docs.botframework.com/connector/calling-api/
Make sure that you republish your bot service after registering and getting the app Id and password. If you fail to do this you will get Unauthorized. The steps are 100% clear on this and I hit this for a minute.