- Lync API is outdated and not very reliable.
- Easy and straightforward dialogs in the framework
And recently I've found a very interesting Bot Framework API called DirectLine.
It allows you to connect directly to the bot with a few lines of code, impersonate users and easily get and post messages. You can grab it from NuGet here: https://www.nuget.org/packages/Microsoft.Bot.Connector.DirectLine/. It also needs to be enabled at your bot configuration page:
Since I had some code that worked with Skype for Business already (using Lync 2013 SDK), I decided to use DirectLine as a proxy.
The idea is very simple:
- Receive message on Skype for Business
- Forward it to the Bot Framework via DirectLine API
- Wait for reply from DirectLine API
- Get the reply and send it to the user
Now, when the message is received, the ImModality_InstantMessageReceived is called. All you need to do is to grab the message text and send it to the Direct Line.
Of course you'll have to add some optimizations to close unused dialogs, and keep track of conversations, but overall, in less that 100 lines of code you can connect to the
server and start the bot conversation.