Bot framework Unable to use with Skype For Business - botframework

I've built a Bot using C#. I tested it using the emulator, web chat, direct line and Skype, and it's working as expected.
I followed the steps to register the bot with skype for business, I waited more than 24 hours to see what's happen.
So far, I can see the Bot as a contact, however, when I try to send a message, the error
"Error happened in Skype for business when reaching bot service. We
saved this conversation. You'll see it soon in the Conversations tab
in Skype for Business and in the Conversation History folder in
Outlook."
Looking for some logs or something, I collected some info, that I'm sharing here.
Analytics from BOT that proves that it's reaching it:
The Log for SFB channel said: "There was an error sending this message to your bot: HTTP status code NotFound"
It's look that the Bot endpoint is not available. When I registered it in SFB, I've been using NGROK (to run agains my machine), but later I've change it to a azure site.
"Old" endpoint is used yet today:
So, all I can guess is that Bot End Point was "registered" at the moment that I made the registration of my Bot in SFB, and now it's not possible to change it.
Does it make sense to anyone of you?
My problem seems to be kind of similar to Bot Framework - An error while sending a message from Skype for Business
Adrián

Ok, I'm sure the problem with the bot was the endpoint registration. I found a powershell script that update the endpoint.
I Opened Windows PowerShell as Administrator and run the ff scripts:
Import-PSSession (New-CsOnlineSession -Credential (Get-Credential))
Set-CsOnlineApplicationEndpoint -Uri sip:username#yourdomain.com
Obviously, I changed username#yourdomain.com with my own.
Then, after waiting 8 hours (or so), I was able to communicate with the bot, using SFB as channel.
Bot running as expected
I hope this can be useful for others.

Related

Teams proactive messages with uninstalled app

I'm trying to build a personal Teams bot which has to send proactive messages regularly. I made it work by storing the conversation when the user installed the app, just like the examples here. Now it works great, but I realized that I keep messaging users that have uninstalled my application. I can't seem to find any event that is triggered when a user uninstalls a personal scoped bot (app).
I tried conversation events, but nothing seems to be triggered for personal scoped bots at least.
I'm using the NodeJs botbuilder SDK.
Open to any suggestions, thanks.
To my knowledge, there is no such event unfortunately. I think you'll just receive a 403 at the moment without much info. This is due to change though - Microsoft just made an announcement about this yesterday in fact. See https://developer.microsoft.com/en-us/office/blogs/best-practices-and-updates-for-bot-lifecycle-events-in-microsoft-teams/ in the paragraph "Changes to post uninstall behavior for bots in personal scope":
Moving forward we’ll also align the post uninstall behavior for bots in the personal scope with the teams and groupChat scopes and you will not be able to send or receive messages after an app has been uninstalled. Your bot will receive a 403 response code to new messages posted by your bot. The 403 response code will have fields telling you the reason behind the it – which is either the app was uninstalled or the bot was blocked. We expect these changes to roll out in the coming few months.

Microsoft Bot send the response twice in Teams

I've used Microsoft bot framework SDKv4, and integrated to Teams channel. It is running well, but giving responses twice.
But, I didn't get the same behavior, while I tested it on Emulator and Web Chat in Azure Portal.
However, I can see below issue, while I ping the bot in web chat and get a response.
Further, I can also see, that its always 'sending' as a status although I got a valid response, and the status later changes to "Send Failed. Retry"
Is the issue related to my teams integration for getting message twice? and how, should I fix it!
Are you using webhooks? If so, having multiple webhooks with same ID could be the reason for double messages. Hope this helps
I made my bot working. It was the issue of MS authentication!
I had a call with MS support person and the root cause appeared to be only the MS authentication. Had to reset app secret and then re-deloyment.
Its weird that, although it was not getting authenticated primarily yet it was returning me the response. This, I still haven't got it!

MS Teams bot no longer receives messages

After moving MS Teams bot to another server, it no longer replies to messages. It still successfully sends proactive messages on its own, however responding to messages no longer works. Messaging endpoint stayed the same (only IP changed)...
I watched for network activity when clicking a button in adaptive card (posted by bot) and error 502 is reported with {"errorCode":1008,"message":"Invoke agent action failed with status code: BadGateway"} returned. I'd appreciate any ideas how to sort this out... Thank you.
If the IP / URL of your bot changed you need to make sure to update the messaging endpoint in the bot definition.
If you registered your bot in dev.botframework.com or azure there's a setting "messaging endpoint url" which you need to update and point to the new ip.
If just the IP behind your URL changed, it might be some caching/dns issue on MS Teams end. Did you try to reinstall the bot completely?

Error when Sending Messages to Skype for Business Bot Framework Bot

I'm having an issue with a Skype for Business bot in one of my Office 365 tenants. I have multiple tenants and in the first one I was able to add a Skype for Business bot framework bot with no issues. It took awhile for the bot to show up in the directory but it worked. In my second tenant, when I add the bot and attempt to send messages to it (even after 12ish hours of waiting), Skype for Business shows an error under each message I try to send to it - "The action couldn’t be completed. Please try again later." Any ideas what might be going on? One difference between the tenants is that the tenant that isn't working ha a custom domain name, and is using Azure AD Synchronization. Based on some tips I saw I made the address of my bot sip:username#mytenant.onmicrosoft.com rather than using my custom domain name. That didn't seem to make a difference... anyone else encountered this/have any ideas? I also tried leaving off the [BotAuthentication] tag on my MessagesController and that did not make a difference as well.
EDIT: Could this have something to do with my custom domain being federated? That's why I went with mytenant.onmicrosoft.com for the username of the bot.
I was able to resolve this. It seems like it has something to do with when you add a bot to a federated domain utilizing the custom domain name. This errors out when you use the New-CsOnlineApplicationEndpoint -Uri bot#domain.com. However, it still creates a bad endpoint. The cmdlet does not error out if you use a uri like bot#domain.onmicrosoft.com. However, after I had already added the bad endpoint, it seemed like no endpoints would work after that. To resolve, I removed all endpoints, including the first bad one with the uri bot#domain.com. Waited 8 hours, added a single endpoint using the onmicrosoft.com Office 365 domain, waited probably about 12 hours, and it started working.

Skype Bot on Microsoft Bot Framework - No response

I've managed to build my first bot and registered it. It works fine with the Web Chat control, but through Skype I'm getting no response. The Skype registration worked and the bot it authorized ("Credentials have been validated."). The bot is enabled too. Just not published yet, but apparently that is not necessary for it to work, no? Inside Skype the bot appears online.
I know that is not much information, but maybe somebody has a few hints?
This is the bot:
https://join.skype.com/bot/d55bb62a-86e8-4eec-be63-4f068e347046
It does not much yet, but it should send a reply.
My fault, I had the wrong Messaging Callback Url in the Skype Bot Portal.
Just for reference, maybe this helps someone:
I had the same problem with my bot, using the VS template. It worked in webchat and Slack but it didn't respond in Skype. I think there is a weird bug with the Skype integration(at least in the default VS template) but try to start your message with a " "(space) or "."(dot). If the message contains a special sign the bot responds as expected.
Example:
'.How are you'
' Hello'

Resources