Agents (or bots) as Siri, Cortana and Google Now are supposed to have an answer for anything but a new trend shows that there is a market for niche bots. On Facebook there are (mostly B2C) bots for providing information about a particular service or for selling you a particular item. On Slack bots are perfect for automating and delegating business related jobs (B2B or B2E).
Niche bots, connecting services
On a dedicated platform that is already been used for most of the communication a bot will be accepted much faster, reason why this time the bots will stay. They are no longer stupid or annoying (Well, Siri for example can still be pretty stubborn), but they actually make sense and can be great personal assisstents, that are capable of connecting one service to another.
If there is an API for that and you can do some smart semantic parsing then developing your own bot is not hard at all. And if it cannot be done virtually you can outsource any task to the real world, for example using
Create a Slack bot yourself
If you do not have a Slack account yet you can sign up for free. Creating a bot on Slack is pretty easy and it will take you probably less than ten minutes to get the first one up and running. For the first sample, using BotKit, you also need to have NodeJs installed on your machine.
Create a bot user at The developers section of Slack. Give it a name and click on the Add bot integration button. It will result in an API token that you will need later and you can add some additional information such as an icon for the bot, a first and a last name and a description of what the bot does.
BotKit
If you are (a little bit) familiar with Node.js and JavaScript you can create your first bot with BotKit. BotKit works with Slack, Facebook messenger and Twilio. Grab it from GitHub or use NPM to get it.
bash npm install --save botkit
Within the botkit folder you will find the slack_bot.js You can start your first bot with this command
token=your token at stack node slack_bot.js
controller.hears(['what time is it', 'how late is it'], 'direct_message,direct_mention,mention', function(bot, message) { var topic = message.match[1]; bot.reply(message, 'It is '+ new Date().getTime()+ ' milliseconds after January 1, 1970. '+ 'Does that answer your question?'); }); });
.NET bot
If you prefer to use the web API instead or if you want to use C# and .NET for your bot then there is a solution for that as well. To get started with developing a Slack bot in C# you can get the .NET SlackAPI project from GitHub.
There is a little bit more work to do here to make it happen as this project, also because it is not as sophisticated as BotKit. First create an app in Slack. At The developers section of Slack go to Your apps and click on the Create app button. Enter a name, a short and long description, select a team and enter some (random for now) url for the instruction link, support link and redirect url fields. Then click on the Create app button.
Slack confirms the creation of the app and when you click on the App Credentials button you will find the OAuth information. You wil need the Client ID and the Client secret information in your .NET app
Visual Studio
Open the SlackAPI solution in Visual Studio, set the SlackAPI.console project as startup project and open the Program.cs file. Here you can modify the values for clientId, clientSecret and redirectUri, just as they appear in your app settings at Slack.
Customize the app a little bit so it will fit your needs. Then run the app and follow the instructions that will read in the console output.
... SlackClient.GetAccessToken((response) => { var accessToken = response.access_token; Console.WriteLine("Got access token '{0}'...", accessToken); // post... var client = new SlackClient(accessToken); client.PostMessage(null, "#general", "This is from the app powered by a "+ ".NET implementation...", "teambotterik"); }, clientId, clientSecret, redirectUri, code);
In this example we post a message directly into the #general channel but with some extra effort we can do anything in .NET that you can do with BotKit. This could be handy if you have already an existing .NET solution that you want to use with your Slack bot or if you are more familiar with C# and .NET than with NodeJs and JavaScript.
Conclusion
In 2016 bots have become relevant again. With better AI and in a more connected world they have become smarter than ever. With bots dedicated to a particular task and the possibility for any company to create new bots to be used on widely used platforms the adoption of chat bots will be much larger than before. They may not eat the web yet but soon they will...
No comments:
Post a Comment