How to send SMS in Linux using Skype

Skype for Linux doesn’t support SMS sending from the user interface. But that functionality is in fact implemented in the library and external apps can use it via the public API. I’ve found a working example of that nice feature. Just do these simple steps:

  1. Download Skype4Py from here, uncompress it and install it typing sudo python setup.py install
  2. Download Skype tools 0.11 from here and uncompress it
  3. Open your Skype client and prepare for the authorization dialog that will appear when you execute the next step
  4. Enter into the previous directory and send the SMS: ./send_sms.py +34123123456 My test sms

If the message takes too much to be sent, stop the app (CTRL+C), delete the authorization using the Skype options dialog, and try again. Third and next times worked fine for me.

11 thoughts on “How to send SMS in Linux using Skype”

  1. Hi, Thanks you very much for your aport

    Have you changed the script so the reciever can see your number instead at your skype name when she or he gets the sms?

    I’m looking for that, but I’m not very good in programming.

    Thanks

  2. I’ve been having a look to the source code of send_sms.py, and it seems that there is a “-r” parameter to specify a “reply-to” phone number, but I haven’t tried it.

    Seeing the API documentation, it seems that it’s impossible to specify an origin number, only that “reply-to” option.

    Hope this helps.

  3. Integrating send_sms.py into kontact / kaddressbook

    I have figured out a method of using the SMS feature in Kontact/kaddressbook in conjunction with send_sms.py and Skype4Py. For the telephone number of the cellphone, under “Mobile” enter the telephone address in the form required by Skype eg +11234567890. The “Mobile” tag shows “(SMS)” at the end of the telephone number, as in:

    Mobile: +11234567890 (SMS)

    Clicking on “(SMS)” (do not click on the telephone number) throws up a small window with the title “Send SMS – Kontact” in which the text message can be entered and also shows a letter count. For the purpose of the script below, if a newline is required in the message enter n as in: “This is line 1nThis is line 2” Do not enter control characters such as newlines directly.

    After entering the text message in the edit window press the “Send” button and the message will be sent. Skype must be running in the background of course.

    Steps to prepare kaddressbook for message sending:

    Pressing the “Send” button in the “Send SMS – Kontact” window creates a small text file containing the text with the filename tmpkde-[username]kontact[6 char string].txt (in KDE3). The variable “%F” created by kaddressbook contains this file name. The variable “%N” contains the telephone number string. So we have the information required for an SMS message but the text is in a file instead of the last part of the input string as required by send_sms.py. The bash script below which I have called “sendSMS.sh” will prepare and send the correct input string to send_sms.py. Prepare kaddressbook to use sendSMS.sh by making sendSMS.sh executable and placing it somewhere in your $PATH such as /home/[username]/bin/. Finally, set up a kaddressbook script hook as follows:

    Kontact -> Settings -> Configure Address Book… ->
    Script-Hooks -> SMS Text:
    enter the following: sendSMS.sh %N %F

    Here is my bash script:


    #!/bin/bash
    # prepare string for execution by send_sms.py
    # ***SKYPE FOR LINUX MUST BE RUNNING***
    # $1 is %N = telephone number in form required by Skype
    # $2 is %F = file name containing text of message
    # this is automatically created by kaddressbook
    # after closing the SMS message window
    # actual file is named (in KDE3)
    # /tmp/kde-[username]/kontact[6 char string].txt
    # Text must be a single line string as the script
    # as written only captures the first line of text.
    # Line breaks in text message may be embedded with n
    # eg. This is line 1.nThis is line 2.
    # enter into Kontact->Settings->
    # Configure Address Book...->
    # Script-Hooks->SMS Text: sendSMS.sh %N %F
    exec 6<&0
    exec < $2
    read line1
    string=$1" "$line1
    exec 0<&6 6<&-
    send_sms.py $string

    Note from the blog editor: I’ve edited this comment and published the whole script you sent me by email. Sorry for the inconvenience.

  4. Integrating send_sms.py into kontact / kaddressbook

    I seem to have exceeded the size allowed for comments and the last portion of the bash script didn’t make it into the comment.

    Here is my bash script:

    #!/bin/bash
    # prepare string for execution by send_sms.py
    # ***SKYPE FOR LINUX MUST BE RUNNING***
    # $1 is %N = telephone number in form required by Skype
    # $2 is %F = file name containing text of message
    # this is automatically created by kaddressbook
    # after closing the SMS message window
    # actual file is named (in KDE3)
    # /tmp/kde-[username]/kontact[6 char string].txt
    # Text must be a single line string as the script
    # as written only captures the first line of text.
    # Line breaks in text message may be embedded with n
    # eg. This is line 1.nThis is line 2.
    # enter into Kontact->Settings->
    # Configure Address Book…->
    # Script-Hooks->SMS Text: sendSMS.sh %N %F
    exec 6

  5. I am sorry but for some reason the “business portion” of the bash script are being filtered out. I have entered the last 6 lines of the script below as comment lines in the hope that they will show up (you will need to uncomment them). These are the lines following the last real comment line:
    # Script-Hooks->SMS Text: sendSMS.sh %N %F

    # exec 6

  6. It didn’t work. Sorry about that. I am not sure how to enter the script. I will monitor the email address I gave for a suggestion from the moderator, otherwise perhaps the moderator could delete my comments.

  7. Thank you for trying to post your script. It seems that the blog went crazy with the “less than” signs…

    I’ve published the script code you sent me by email as an independent file, just in case you want to get it from here. I’ve also edited your original comment as administrator and pasted there the script code.

    Anyway, it’s already published in the OpenSuse forum, following the link you gave.

    Thank you very much!

  8. I receive:
    Traceback (most recent call last):
    File “./send_sms.py”, line 154, in
    api = SkypeSMS()
    File “./send_sms.py”, line 32, in __init__
    self.api = Skype4Py.Skype(Events = self)
    File “/usr/local/lib/python2.6/dist-packages/Skype4Py/skype.py”, line 243, in __init__
    self._SetEventHandlerObj(Events)
    AttributeError: ‘Skype’ object has no attribute ‘_SetEventHandlerObj’

    Anyone else get this?

  9. Same prroblem… Centos 5.3 64 bits

    Traceback (most recent call last):
    File “./send_sms.py”, line 154, in ?
    api = SkypeSMS()
    File “./send_sms.py”, line 32, in __init__
    self.api = Skype4Py.Skype(Events = self)
    File “/usr/lib/python2.4/site-packages/Skype4Py/skype.py”, line 243, in __init__
    self._SetEventHandlerObj(Events)
    AttributeError: ‘Skype’ object has no attribute ‘_SetEventHandlerObj’

Comments are closed.