This will be the first part in a series of blogs about an escalated hobby project and the discovery of an amazing new technological development: Bots.

TRAVIAN

In an earlier blog, I explained how Lightning Connect can be used to extend storage on developer orgs. Since then, this hobby project has escalated way beyond.

Let me first describe the hobby in question a little bit more..... It's a browser-game called Travian. A fairly crude war game, which involves a lot of teamwork between roughly 100 players scattered across the world, in different time zones. As you would expect with a war game, defence is part of the gameplay. In Travian, defence involves analyzing a lot of data. I will spare you the details :)

To make defence easier, several challenges need to be solved:

  1. A user friendly way of collecting data about incoming attacks
  2. An easy way for the defence leaders to sort the data, classify it, compare it and base decisions on this
  3. Automatic notification of defence leaders, ideally through Skype

Force.com is a perfect platform for 1 and 2, so that choice was easily made. For the moment solving 1 and 2 was my main goal. Using Lightning Connect to fetch the data from a Travian SQL file and a Force.com site to collect data from players. On the site players can simply copy/paste the contents of their browser window into a form and submit it. A bit of APEX regular expression magic takes care of filtering out the relevant data and storing it in the Force.comdatabase. This already allowed a sub-optimal solution to 3, using email and chatter notifications.

The Skype part of challenge #3, is what set me on a journey leading me eventually to the Microsoft Bot Framework, but that's something I will talk about in a subsequent blog.

SKYPE INTEGRATION: TAKE ONE

My first quest on Google to find ways to get Salesforce to communicate with Skype, led me to the Skype Java API. This Java library allows you to send and receive messages on Skype, on behalf of whatever Skype account is currently logged in. It only works when it's running alongside a Skype desktop client on a PC.

The Java bot was easy to make, since it mostly concerned parsing incoming messages, in the form of commands, and sending outbound messages pro-actively (for the notifications), or as a response in a conversation. Using Force.com's Streaming API to send notifications from Salesforce when a player submitted data, and the Salesforce SOAP API to have the bot collect information from the database, this ended up in the orchestration displayed in the image below (click to enlarge).

The Skype part of this approach had several downsides:

  • It required me to run a Skype client on a local Windows Vista PC 24x7
  • The server had to run 2 Java processes 24x7
  • The Java processes, Skype and the PC crashed randomly (and required a manual reboot)
  • The old backup PC I used for this purpose was noisy. Very noisy.

Even with all its downsides, the set-up was already a major improvement to the game. It served the purpose. But cloud-minded as I am, the Skype part had to be improved. The local server was a thorn in my eye and a spike in my energy bill ;)

Then, some day, I stumbled upon the very bèta, very new, bot framework. This framework works for Skype, but goes beyond that. I will tell you all about it in my next blog!

Add comment


Security code
Refresh