The bot skeleton consists of a number of node modules. While all the modules provide some important function the main module responsible for Spark functions such as webhooks, posting messages and emitting bot events is the Flint framework. Flint is being constantly updated by it creator Nick Marus. Nick has done a great job on creating an easy to use framework. Once you have done the setup once or twice creating new bots is a matter of minutes project.
The skeleton I created also contains a simple integration to IBM Watson’s Conversation API. Unfortunately the documentation on the Conversation API for the node module is a little low on details. I am hoping to in follow up post to go more into depth around using context with Watson’s Conversation API. There is some good info and examples out there from a few of the IBM folks which I am using right now to build out a more complex bot integration. There are a lot of high level demo’s and videos out there but there isn’t much informaiton on doing something a little more complex. If you are looking to do a Spark bot or a bot on another platform, the Watson context object is critical to get complex dialogs working but for now lets look at something a little simpler.
Spark Bot InformationA lot of the info below comes from the readme on my GitHub repo but I have extended some of the details here in case you need some extra help.
- Spark user/developer account – Pretty simple. Download the mobile app or go to the web and signup for an account if you don’t have one already. Once complete sign into the developers portal using the same account details.
- Spark bot account – Once you are in the Spark developers portal head to “My Apps”. Its right next to your avatar. Creating the Spark bot account is very simple just fill out the form. The hardest part is finding the right avatar. Once you filled everything out and saved your bot don’t forget to grab the bots access token from the page. you will need it a little later.
- IBM Watson credentials – Rather than rewriting the great work of others at IBM, here are some quick pointers to info.
- Cloud 9 hosting (optional)
IBM Watson Conversation API'sFor those of you that are actually at any of the TechCrunch hackathons there are alternatives obviously to Watson but you don’t have a chance of winning any prizes if you use them. This is just the start of integrating with Watson’s Conversation API’s, in a follow up I will talk more about using MongoDB to track conversation context based on room and email ID’s. This simple use of the Nodejs module will get you started but for more complex interactions you need context. But for now here is a little more help:
- IBM Watson Conversation API provides a natural language interface to help automate interactions for chatbots.
- IBM provides a web interface to help create Intents, Entities and Dialogs along with an extensive nodejs module which is used in this skeleton.
- API calls are made to the Watson service via the Nodejs Watson module.
- Great demo from IBM Watson Team
Cloud 9 hosting by AmazonThis is one of the coolest development cloud IDE’s out there. You can use a variety of languages and the Cloud 9 team have done a great job at making it easy to add additional components to a container. Its integrated with Github Oauth to make it easy to signup and sign in.
- Cloud 9 is a cloud IDE/hosting platform
- Cloud 9 hosting documents
- Cloud 9 Introduction Video
- ***Ensure to upgrade the default version of Express if using Cloud 9 per the dependencies below which is also in the package.json file. The default version of Express if using the predefined workspace is below the requirements for the Flint frame work. So make sure to run the “npm install express –save’’ after removing the old Express version from your package.json file.
Dependencies for Spark Skeleton-
- "async": "~0.2.8",
- "body-parser": "^1.15.2",
- "express": "^4.14.0",
- "fs": "0.0.1-security",
- "node-flint": "^4.1.1",
- "path": "^0.12.7",
- "watson-developer-cloud": "^2.2.0"
Setting up config.example.jsBelow is the config example file from Github. To enable this file on your real project make sure to fill in all the expected access tokens and keys and rename the file to config.js. Pretty simple really but I thought I would highlight it as some people may not realize this needs to occur.
Running the server with debugDEBUG=flint,bot,sparky node server.js
- Cisco Spark Bot SDK Framework
- Cisco Spark Developer
- IBM Watson Conversation
- IBM Watson NodeJS Module
- Cloud9 by Amazon