This is a post from the Skype Bot for Fun and Profit series. This is the second part in the series and if you want to get your bot running you will need to have some prerequisites filled out, see the first part.
Configuring and running
There is a skype-bot project at github. It is written in Java and has support for simple functionality. You can clone it via:
git clone https://github.com/toomasr/skype-bot.git
The project is maven based and once you import the project into your favourite IDE that has maven support it should compile out of the box. Before we can actually run the project we need to make couple of adjustments. First make a copy of the project.properties file and make it personal.properties. Then change the username, password and pemfile attributes in the file. Make sure that the folder that has the pem file also has a der file that has the same name (except the extension of course).
Next lets build the project. It is sufficient to just issue a
mvn install command. You will end up with a skype-bot-0.0.1-SNAPSHOT.jar in the
target folder. Before we can run that we need to start the runtime (see the first post in the series on how to do that). Now we are ready to start the bot. Issue a
java -jar target/skype-bot-0.0.1-SNAPSHOT.jar. Now expecting that the Runtime is still running and that you updated the credentials in the personal.properties file you should see your need friend come online and you can start a chat. The bot has the commands that he reacts to defined in the
org.zeroturnaround.commandspackage. But for starters you can tell him “bot: time” and it will tell you the time.
The bot also launches a web server on port 2500 that has defined handler on the url
http://0.0.0.0:2500/post. You can send a POST message there with the parameters message=? and group=?. This will instruct the bot to issue the message to the group. The group is looked up from the bot’s list of groups that matches the
Conversation.PROPERTY.displayname. So what can we do with this? Most of the todays services have webhooks. For example GitHub has Service Hooks, FogBugz have Web Hooksand others have similar services. This means that you can register a web hook and when an event happens the bot will tell you over Skype (in a group chat for example).
This is up to you, hopefully you have a friendly bot. Make him tell you important information that you care about and don’t let him waste your time.