Archive for the tag 'sms'

SMSler: Sending SMS over free HTTP web services

In Switzerland, many (all?) mobile operators providing a web service for sending an amount of free SMS over their website. The only thing to do is to register a username and a password. I wanted to use this free service with my servers, so they can inform me by sending also a free SMS over HTTP if there are any problems.

There are two simular projects: SwissSMS for OS X in C# and Java Swing GUI SwissSMSCient. But I just wanted to have a small library in Java, which can be used to send SMS messages by bash scripting or building a GUI based on it, whatever you like.

So I developed a mavenized library named LibJSMS in Java licensed unter LGPL, which can be used in a shell script as following:

1
2
3
4
#!/bin/sh
# Example:
# java -cp LibJSMS-x.y.jar net.renemoser.libjsms.App <userid> <password> <phoneNumber> <message> <provider:default=SunriseCH> 
java -cp LibJSMS-0.4.jar net.renemoser.libjsms.App example@sunrise.ch secret 0761234567 "Error message..." SunriseCH

If you like to use the library in your java code, it would look like this:

1
2
3
4
5
6
7
8
import net.renemoser.libjsms.service.*;
try {
    ShortMessageService Service  = new SunriseCH();
    Service.doLogin(userid, password);
    Service.sendShortMessage(phoneNumber, message);
} catch(Exception e) {
    e.printStackTrace();
}

or by using the service factory class:

1
2
3
4
5
6
7
8
9
import net.renemoser.libjsms.service.*;
String provider = "SunriseCH";
try {
    ShortMessageService Service = ServiceFactory.getService(provider);
    Service.doLogin(userid, password);
    Service.sendShortMessage(phoneNumber, message);
} catch(Exception e) {
    e.printStackTrace();
}

At the moment, the library can only use the 2 Operators Sunrise and Orange. Because those are the 2 only accounts I had.
But the operator Swisscom or even any operator of the world could be added. I would love to the get any patches for additional operator suppport to my email address, which can be found on my contact page.

The library using Java 6 only at the moment. The most recent version of this library can always be found on my GitHub Account.

I also wanted to have a desktop GUI application for using this service. So I developed a small Java desktop application named SMSler licensed under GPLv3 using this library with Netbeans. I know you like screen shots:

You can download my first release in the download section of my GitHub account. I am also providing an exe file for windows users, build with help of launch4j. It is tested on Debian, Ubuntu and Windows XP as long as you have Java 6 installed. Mac OS X 10.5 still uses Java 5, so this won’t work unfortunately.

After starting the application, make sure you are setting up a preferences file under the “Menu File –> Perferences”. This creates a preferences file in your home directory in .smsler/main.preferences.

Feel free to send me feedback and improvements.