BotFramework is by far the most diversified bot development framework when it comes to the multi-channel support. The only famous conversational (sort of) channel left as of now is Twitter, which I believe will be added officially, very soon (I wish by Build 2018). I have been using Twitter since past decade and till today, it’s my most used and favorite platform. During these years, I got connected with so many inspirational personalities.
Twitter has been very dynamic when it comes to changes in their APIs and its schemas. I think this is the reason why other platforms do not get coupled with it easily. Having said that, Twitter has its own significance when it comes to customer service, official notices etcetera. Therefore, today, I’ll briefly explain you how can you easily integrate and automate your FAQ section for your prospect customers on this platform.
It totally depends upon you if you really want to use the same code-base as your bot (which is currently responsible for handling other channels) or you can just write a separate class which will handle twitter only responses.
For the simplicity, I have gone with the latter approach. I installed the Tweetinvi as this is the best Twitter library for C#. I have simply created a separate class called TwitterController where I have written all the essential methods and registered the necessary events. You can just replace the key place holders with actual keys. In Global.asax file, I’ve called the main method to start the stream of twitter.
In this post, I will not explain how to create your brand’s app on twitter. However, you can easily create from https://apps.twitter.com/.
QnAMaker is another simplified service which can be used to build, train and publish a simple question and answer bot based on FAQ URLs, structured documents or editorial content in minutes.
Let’s say you’re a house-keeping company, you already have prepared the FAQs for your potential customers and it’s already available on the website. I would just give the URL to QnAMaker and it will compile all those questions / answers in a bot-readable format.
There are several ways to consume this service but I would go with the REST. Therefore, the code sends whatever is written by the user and in response, it gets the best possible answer against that question.
As simple as that, your twitter bot is ready to serve!
Azure App Service pauses if it does not encounter any activity (or if it goes in idle mode). In order to keep it always active, you need to enable ‘Always On’ feature that requires basic paid subscription.
As a workaround, in order to keep your twitter bot to be responsive, keep your bot communication intact, always.
Like always, the code is available for your valuable contribution on github.