Posting messages on a Skype group channel using Python

I recently wrote a script to post messages on Skype using Python. I used the excellent SkPy module. The module’s documentation is very good but examples on how to post messages to group chats was sparse. I had to muddle around, try things out with the Python interpreter and figure things out. In fact, I am not sure if I did it in the most elegant way possible. However, what I did was more than what was available online. So I thought I would document what I did in this post.

The rest of this post has this flow:
1. Setup
2. Establish the connection
3. Identify the channel id
4. Select a group channel to post the message
5. Post a message
6. Putting it all together

1. Setup

I signed up for a Skype account and added it to one of my group channels. I also sent one message on each of the channels after I added the new Skype account.

On the Python side, I simply did pip install SkPy

2. Establish the connection

From here on, use your Python interpreter to execute the commands below. It is easier to get started that way as opposed to writing a script. You can move to a script once you have figured out how to work with SkPy.

To connect with your Skype account:

from skpy import Skype
skype_obj = Skype(username,password) #use your real username and password here

If the connection fails you will see an error in the interpreter. If the connection succeeds, the interpreter prompt returns silently.

3. Identify the channel id

This is the portion where I got stuck initially. I did not know how I could get the id of the channel. For example, when I tried skype_obj.chats, I simply got a cryptic SkypeChats(). Then, after playing around a little bit, I noticed we could do skype_obj.chats.recent() which returned a list of dictionaries that had information on the different group channels. A typical group channel id would look like: '', where 19 is the number associated with group chats while 8 is a number associated with 1:1 chats.

skype_obj.chats #Returns SkypeChats() Not useful
skype_obj.chats.recent() #aha! This was useful

4. Select a channel

Now that we have a channel id, it is simple to fetch the channel handler.

channel ='')

5. Post a message

Posting a message is well documented and intuitive.

channel.sendMsg('Hello! This is my first automatic message.')

6. Putting it all together

My method looked like this in the end:

def post_message(msg,channel_id): 
  "Post a message" 
  sk = Skype(credentials.USERNAME,credentials.PASSWORD) 
  channel = 


a) Official SkPy project:
b) Source code of SkPy:
c) Documentation for SkPy:


You can see how I use this code and put out a different message every weekday in this repo:

Arunkumar Muralidharan

I want to find out what conditions produce remarkable software. A few years ago, I chose to work as the first professional tester at a startup. I successfully won credibility for testers and established a world-class team. I have lead the testing for early versions of multiple products. Today, I run Qxf2 Services. Qxf2 provides software testing services for startups. If you are interested in what Qxf2 offers or simply want to talk about testing, you can contact me at: I like testing, math, chess and dogs.

Be First to Comment

Leave a Reply

Your email address will not be published.