Tom's Blog

From tech to non-tech

Skype Bot for Fun and Profit - Part I

| Comments

This is a post from the Skype Bot for Fun and Profit series. This is the first part in the series and will let you configure everything needed before we actually get to the code part.

Join the Skype Developer Program

A lot of necessary documentation and also software is behind a login screen at Skype Developer Program. You will need to join the program to continue and log in. This used to cost 10$ but I’m not sure if that is true anymore (if you sign up and find out, let me know!). I personally don’t like the monetary fee for documentation and a SDK but I’m happy this is not 100$.

Now the biggest challenge has been conquered and you can also open up Skype’s own Getting Started Guide. That guide will go into more details with some of the next steps, so if you get stuck here be sure to check their documentation also.

Create a new project at Skype

Lets create a new project at the developer page. Navigate to My Projects submenu.There you can choose between multiple projects to create. Right now you need to choose SkypeKit for Desktop. You can name the project something along the lines of chat-bot-demo and fill the rest of the form how ever you like (or they require). Now we have a project in place and we can move on.

Download the SDK and the Runtime

Navigate to your just created project and lets get the SDK and Runtime. SDK is the library (com.skype.*) that you will use to talk to the runtime (headless Skype client). Runtime is the binary headless Skype that is in the bin folder of the SDK & Runtime archive.

Build a skypekit.jar file

The SDK comes in source format only, before we can continue we need to get this into a single JAR file and also install it in your local Maven repository. To build it we need ANTto be installed (I presume you do). Issue the following commands now:

toomasr@cigarillo-2 ~/sdp-distro-desktop-skypekit/interfaces/skype/java2/api » ant
Buildfile: /Users/toomasr/sdp-distro-desktop-skypekit/interfaces/skype/java2/api/build.xml

clean:

compile:
    [mkdir] Created dir: /Users/toomasr/sdp-distro-desktop-skypekit/interfaces/skype/java2/api/bin
    [javac] Compiling 52 source files to /Users/toomasr/sdp-distro-desktop-skypekit/interfaces/skype/java2/api/bin

jar:
      [jar] Building jar: /Users/toomasr/sdp-distro-desktop-skypekit/interfaces/skype/java2/api/skypekit.jar

clean-build:

main:

BUILD SUCCESSFUL
Total time: 3 seconds

We have the skypekit.jar file now in that api folder. For easier project setup we will be using Maven (and probably for some of you shoot you in the foot as an added bonus). We will need to install the JAR file into our local repository. I will use com.skype as the groupId and skype-sdk as the artifactId. Issue the following command to do the same.

toomasr@cigar:~/$ cd ~/sdp-distro-desktop-skypekit/interfaces/skype/java2/api 
mvn install:install-file -Dfile=skypekit.jar \\
  -DgroupId=com.skype -DartifactId=skype-sdk -Dversion=1.1 -Dpackaging=jar

So now you have the artifact in the local Maven repository. If you want to share it with your team just deploy it to your central repository. I hope one day Skype will handle that and the SDK would be available in the Maven central.

Run the runtime

Now lets check if the runtime starts. Navigate to the bin folder and startup the version of your platform. If everything goes successfully you should see something similar.

toomasr@cigarillo-2 ~/downloads/sdp-distro-desktop-skypekit/bin/mac-x86 » ./mac-x86-skypekit
SkypeRuntime Copyright (C) 2003-2012 Skype Technologies S.A.
SkypeRuntime Version: 4.5.0.105/mac-x86-skypekit_4.5.0.105_2859383
Proprietary and confidential, do not share this application.

Development keypair

Next we need a development keypair. It is a signed RSA private key that you need to request from the Skype developer website. See the screenshot.

Once you have the file downloaded lets convert it to a format that is used by the Skype SDK. This is the openssl command for this. Be smarter than me and don’t accidentally overwrite the downloaded PEM file because they let you download it only once. The keypair is valid for 60 days!

openssl pkcs8 -topk8 -in download-pair.pem -outform DER -out downloaded-pair.der -nocrypt

Create a Skype account for the bot

Go to skype.com and create an account for you bot. Also add this bot to your friend list and log in once with the bot and accept the request.

Lets sum it up

By now we should have the following in place

  • Have 10USD less on you bank account
  • Skype Developer account
  • A project created at Skype Developer page
  • Working Skype Runtime
  • Skype SDK jar file
  • Development Keypair in PEM and DER format
  • New contact on your contact list and its username/password

If you are missing any of those or had problems getting them then check out the more in depth documentation at developer.skype.com or post a comment. Where to go from now? Check out the next part, Getting it Running.

Comments