[O365] Adding your chatbot to Skype for Business
Have you been coding your chat bot using the Microsoft Bot Framework? Good news! One of the long awaited features is finally here: the Skype for Business channel! Using this channel, you can now get your but to communicate with users using Skype for Business. This is especially good news for enterprises where S4B is often the primary communication tool. Bots were already available through Microsoft Teams, but not all companies are ready for that yet. Skype was in there as well, but is mostly used on the consumer side. So great to have Skype for Business joining the club!
How to enable the Skype for Business channel
Enabling a bot for a new channel is usually pretty simple. The Skype for Business channel though requires a bit more work.
Note: in order to perform this step you need to be an admin of your Skype for Business instance.
Here’s what you need to do:
- Go to https://www.botframework.com, log in and click on the bot you want enabled.
- Add the Skype for Business channel to your bot.
- When the channel has been added, the page will display:
Your bot is enabled for the Skype for Business Channel.
Want to add your bot to Skype for Business tenant?
underneath is a link that says Learn how. The link could’ve better been a button if you ask me, there’s not much emphasis now even though the instructions on that page are critical to get it working.
- The page will list some commands you need to run in a Powershell window. First, Download and install the Skype for Business Online Connector module and then run:
Import-PSSession (New-CsOnlineSession -Credential (Get-Credential))
- This will enter you into a session connected to the remote Skype for Business cmdlets. Now you need to register your bot:
New-CsOnlineApplicationEndpoint -ApplicationId 110e87ba-9f5e-407e-a199-037e0f05bb35 -Name NameOfTheBot -Uri sip:username@yourdomain.com
There’s a little catch here. The example says username@yourdomain.com. Actually this should’ve said: username@tenant.onmicrosoft.com. Adding a user using a custom domain as the sample shows does not work, at least not at this time. You’ll get a pretty non-descriptive error saying “Cmdlet invocation error” and “Could not find the application endpoint” if you try to do it this way. So make sure you pick a user from your tenant and that you use the tenant.onmicrosoft.com domain to identify it.
Now your bot will, after a wait (which can take up to 8 hours), appear in Skype for Business and users can interact with it. There are numerous possibilities for this. For instance, our bot helps us with tasks like requesting leave, booking hours and remind me to book my hours when I once again forgot to 😉
Update: after waiting for a while, you might be able to find your bot in the Skype directory, but interacting with it doesn’t work. This problem is being looked into, as soon as I know a way to resolve it I’ll update this blog post accordingly.
Update 05/29: after waiting some more I decided to delete the endpoint and retry creating it. And sure enough, my bot is now responding! Problem solved, it seems.
May 22, 2017 at 3:08 pm |
Hi Jasper. After the May SfB CU, you can use the username@yourdomain.com
But I’m still not able to see it in the SfB client. I also had to run a command to create the user my on-premises domain.
Do you know if I missing anything else?
May 22, 2017 at 3:37 pm |
Hi Hubo,
Unfortunately I have no solution yet. I’m using using the on-prem version but an Office365 instance, it’s not working there either. When I find out what is wrong, I’ll update this post accordingly.
June 28, 2017 at 7:28 pm |
Hello, I’m sorry to bother you, but since I’m trying to create a BOT to be used with SFB, I’d like to know something: Is there posible to know the name (user name, or display name) from the person the BOT is chatting with?
The BOT will perform some tasks on behalf of the user, and I don’t know to add an extra step to the BOT asking to the user “who are you?”, or performing some extra authentication methods.
Thank you in advance
June 28, 2017 at 9:06 pm |
Doesn’t bother at all 🙂 You can get the name from your user from the channel data, but the question is: how reliable / safe is that? For authentication you’re currently bound to doing an OAuth authentication between your user and the service you want to use. Check the OAuth sample for that: https://blogs.msdn.microsoft.com/tsmatsuz/2016/09/06/microsoft-bot-framework-bot-with-authentication-and-signin-login/
There’s a lot of folks asking about this and it would make much more sense that your bot can get at least some authentication info when you’re already signed in to Office365. I am guessing there might be something of a consent screen in the future that gives the user control over what your bot can and cannot access.
September 8, 2017 at 8:36 am |
Hello, I know it’s a very basic question. but I just need to know.
I created a bot, working on all other channels, then I registered with skype for business.
I created a new user for skype for business in my tenant then perform the steps described in Bot framework, all commands ran successfully, I can search the bot skype for business but it shows offline and doesn’t respond. I am waiting for a couple of days.
Do I need to create a user for skype for business before running the commands?
September 8, 2017 at 2:46 pm |
Hi Sunil!
Questions are never basic or dumb, glad you posted! It’s hard to judge with little information. I would guess that you need to create the user before you register the channel, yes. Best way is to just find out. Anyways, if it has been days and there’s still no action, safe to assume that something did not turn out right and you’ll need to retry the procedure.
October 21, 2017 at 7:35 pm |
Hi jasper,
We are in the process of creating a BOT for S4B and we would like to know is there any way we can out BOT to users contacts or display our BOT on the Top for someone to use it easily and also kindly help us with the information on how we make our BOT appear on top of the list whenever users try to search for a BOT of my BOT category.
Thanks in advance for your help.
Regards,
Krishna
October 22, 2017 at 5:09 pm |
Hi Krishna,
You certainly can do that. This type of messaging is called “proactive messages” which basically means the bot contacts the users instead of the other way around. You’ll find some more info here: https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-proactive-messages. For having a bot appear on top, I would suggestion looking at naming it so that it lists on top in an alphabetical order. I’m not sure whether S4B allows you to ‘pin’ contacts / favorites for your users.
Cheers, Jasper