DEV Community

Cover image for How to automate Skype?
Maulik
Maulik

Posted on

How to automate Skype?

Skype, Hangout, Slack, Microsoft Teams, zoom, and many more chat and video calling applications we have but as a developer, we use a single application for a project, mostly one that our client is comfortable with.

I have to use Skype and there are no official APIs for automating Skype unlike other applications so I found an unofficial opensource python library SkPY for interacting with the Skype HTTP API.

The aim of this library is to provide feature-complete support for Skype for Web. So far, it supports:

  • contacts: retrieving the contact list and groups, sending and responding to invites, searching the directory
  • conversations: sending text messages, marking read, rich text formatting, file/image transfers, shared contacts
  • group chats: creating new conversations, adding/removing members, delegating admins, setting topic/history, join URLs
  • events: receiving conversation messages, status and endpoint changes
  • and more: translation API, user settings, credit/subscription info

Here is the sample python code snippet to automatically respond to a message

from skpy import SkypeEventLoop, SkypeNewMessageEvent

class SkypePing(SkypeEventLoop):
    def __init__(self):
        super(SkypePing, self).__init__(username, password)
        print("initialized! watching for events")
    def onEvent(self, event):
        if isinstance(event, SkypeNewMessageEvent) \
          and not event.msg.userId == self.userId :
          # sending automated reply
          event.msg.chat.sendMsg("Hi there! Maulik is currently not available. If urgent you can call him at 91********")

sk = SkypePing()
sk.loop()
Enter fullscreen mode Exit fullscreen mode

Let's see the demo

We can achieve many things by automation like we can create a script to send a reminder to a group/person and schedule it through cron job or we can keep watch on how many calls we have attended and how much time we spent on skype meetings etc.

Top comments (2)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.