Hello, Botkit! A Very Warm Welcome to Botkit.ai

Jose de Castro

Wednesday, February 15th 2017

One of our favorite parts of the Cisco Spark dev community is how open it is. There’s something exciting for devs at every stage of their journey, whether they’re old pros in the Cisco Spark Depot or just starting out — and that makes for a diverse ecosystem of innovators.

 

But for all these unique voices, there’s one thing we hear all the time: “Got any bot-building shortcuts?” Now, thanks to the Botkit from botkit.ai, the answer is a resounding yes.

 

So, friendly Cisco Spark Devs, please give a warm welcome to Botkit, the leading open source bot framework. Botkit is a free, MIT-licensed, open-source framework that simplifies the bot-building process by providing a semantic interface for sending and receiving messages so developers can focus on creating novel applications and experiences. With support for Cisco Spark, Botkit developers now have access to one of the largest network of collaboration customers and partners on the planet. Together, we can transform the collaboration experience.

 

In 2016, BotKit was downloaded over 100,000 times and there are over 25,000 production Bots that are powered by BotKit from companies such as, PayPal, Concur and Hotels.com. All of which can now take advantage of this new Botkit release and add support for Cisco Spark.

 

Botkit makes it easy for you to create bots for Facebook Messenger, Slack, the Microsoft Bot Framework, and more. And because Botkit bots — both new and existing — are now compatible with Cisco Spark, you can share the majority of your existing code between platforms.

 

Ben Brown, CEO of Botkit.ai, says:

“Our goal in building Botkit was to give developers an easy-to-use tool that let’s them take advantage of all the best resources for building bots. Bots on Cisco Spark have exciting capabilities that we haven’t seen before, and we’re excited to see where the developers lead us”

 

With Botkit, you can choose to work in either the code-level framework, written in Node.js, or the soon-to-be-unveiled IDE for Visual Bot Building — which will allow you to spend less time worrying about how the Cisco Spark API works, and more time actually building your bot. There are even free plugins that allow Botkit to interact with services like IBM Watson, API.ai, Wit.ai, or Luis.ai for an instant boost to your bot’s conversation skills.

 

One of the major benefits of building your Bots on Botkit is the ability to share code between Bots designed to work on different platforms. Let’s take a look at a simple code example that shows how to port a Botkit project from Slack to Cisco Spark:

 

# Slack Hello World

var Botkit = require('botkit');

var controller = Botkit.slackbot({
    clientId: process.env.clientId,
    clientSecret: process.env.clientSecret,
    scopes: ['bot'],
});

controller.setupWebserver(process.env.port,function(err,webserver) {
  controller.createWebhookEndpoints(controller.webserver);
});

controller.hears('hello','direct_message,direct_mention', function(bot, message) {

    bot.reply(message, 'Howdy!');

});


# Steps to port

Change 4 lines where Botkit controller is created.

Add 1 line to spawn the bot in Cisco Spark.
> var bot = controller.spawn();

Change the webhook signature by adding bot parameter.

>  controller.createWebhookEndpoints(controller.webserver, bot);
                                                        

# Cisco Spark Hello World

var Botkit = require('botkit');

var controller = Botkit.sparkbot({
    public_address: process.env.public_address,
    ciscospark_access_token: process.env.access_token,
    secret: process.env.secret, // this is an RECOMMENDED but optional setting that enables validation of incoming webhooks
});

var bot = controller.spawn();

controller.setupWebserver(process.env.port,function(err,webserver) {
  controller.createWebhookEndpoints(controller.webserver, bot);
});

controller.hears('hello','direct_message,direct_mention', function(bot, message) {

    bot.reply(message, 'Howdy!');

});



 

Simple enough, right?

 

If you’d like to start your own Botkit adventure, head on over to Github to get started. Our Cisco DevNet team have been busy working on sample code and have a developer community to help you work on your Cisco Spark bot to help you become a Botkit expert in no time! And after that, head over to the Cisco Spark Depot to submit your finished bot.

 

We can’t wait to see what you build!

 

To get all the latest updates about Cisco Spark for Developers, follow @CiscoSparkDev.

 

 

- Jose de Castro, CTO of APIs & Integrations