Skip to content
leecher1337 edited this page May 26, 2015 · 4 revisions

Sending Messages

This is done with the SDG command. It generally has the following structure:

SDG 43 MSGR 686
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: {msgtype}
Content-Type: {contenttype}
Content-Length: {contentlen}

{payload}

Content-Length is the number of bytes following the header. Payload data has been formatted here for better readability, normally there are no line breaks between XML-Tags, so don't be confused by the wrong Content-Length in these examples.

When sending such a message, it is populated nearly in the same form to the recipient, so user1 i.e. would receive:

SDG 0 MSGR 632
Ack-Id: 0000013E745CEE19
Context: 1B8D4AA7AD8F8D02

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-ID: 1431882693260
Client-Message-ID: 10829167517486132349
Message-Type: {msgtype}
IM-Display-Name: User 1
Relationship-Type: Explicit
Is-Active: true
Original-Arrival-Time: 2015-05-18T20:15:31Z
Skype-Age: 18
Content-Type: {contenttype}
Content-Length: {contentlen}

{payload}

Therefore it is not necessary to give an example for every received message too, basically the receiver just needs to parse the same fields like in the sent message.

Messages can be sent to both individual or chat groups (Threads). Just use the appropriate WLID of the target.

There are various Message-Types that can be sent:

Text

Plain text messages

SDG 95 MSGR 763
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: Text
Client-Message-ID: 6643607751647822671
IM-Display-Name: User 1
Content-Type: Text/plain; charset=UTF-8
Content-Length: 2

hi

Text/VideoMessage

RichText

Text messages which can contain Markup for emoticons etc.

SDG 95 MSGR 763
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: RichText
Client-Message-ID: 6643607751647822671
IM-Display-Name: User 1
Content-Type: application/user+xml
Content-Length: 34

hi there! <ss type="smile">:)</ss>

RichText/Location

RichText/UriObject

Sends a web address, i.e. when sharing Fotos via the Skype "cloud".

Message

SDG 95 MSGR 763
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user2
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Client-Message-ID: 6643607751647822671
Message-Type: RichText/UriObject
IM-Display-Name: User 1
Content-Type: application/user+xml
Content-Length: 456

<URIObject type="Picture.1" uri="https://api.asm.skype.com/v1//objects/0-neu-d2-c00e2b95a2f4a0e8d99570be75395bfc" url_thumbnail="https://api.asm.skype.com/v1//objects/0-neu-d2-c00e2b95a2f4a0e8d99570be75395bfc/views/imgt1">
<Title></Title>
<Description></Description>
Das freigegebene Foto finden Sie unter https://api.asm.skype.com/s/i?0-neu-d2-c00e2b95a2f4a0e8d99570be75395bfc
<meta type="photo" originalName="ducky.jpg"/>
<OriginalName v="ducky.jpg"/>
</URIObject>

uri is the URL of the image information. You can only fetch it by placing a skype_token in the Authorization: header (see below). This will return some json specifying the size of the image:

{"id":"0-neu-d2-c00e2b95a2f4a0e8d99570be75395bfc","type":"pish/image","contents":{"imgpsh":{"length":1485978,"full_length":1485978},"imgo":{"length":109829,"full_length":109829}}}

You can fetch the image from https://api.asm.skype.com/v1//objects/0-neu-d2-c00e2b95a2f4a0e8d99570be75395bfc/content/imgpsh (replace the id here with your id). Also don't forget Authorization header.

url_thumbnail is the URL of the thumbnail preview image, i.e. to display in chat history. Also only available with Authorization: header.

The text is the most compatible method to get the image. The user can click on the link and a new browser window is opened where the recipient needs to sign in to the Skype network and then can view the image.

Cloud sharing API

To share something using the Microsoft Cloud services, you first need the skype_token for authentication. With this token, you can access the contants being sent in the various URLs by sending the following Authorization: header:

Authorization:    skype_token {skypetoken}

Where {skypetoken} is the token you get like mentioned in Chapter Authentication.

To upload an image to the cloud:

  • Fetch a new ID for the image to upload
POST https://api.asm.skype.com/v1//objects

Authorization:    skype_token {skypetoken}
Content-Type:     application/json; charset=utf-8

And you receive a JSON object with the ID of your new upload:

{
    "id": "0-neu-d3-c00e2b95a2f4a0e8d99570be75395bfc"
}
  • Assign read permissions for the object to the recipient(s)
PUT https://api.asm.skype.com/v1//objects/0-neu-d3-c00e2b95a2f4a0e8d99570be75395bfc/permissions

Authorization:    skype_token {skypetoken}
Content-Type:     application/json; charset=utf-8

{
    "live:user2": [
        "read"
    ]
}

Don't forget to replace the ID in the URL with the one you received in Step 1.

  • Upload the image to the cloud storage
PUT https://api.asm.skype.com/v1//objects/0-neu-d3-c00e2b95a2f4a0e8d99570be75395bfc/content/imgpsh
Authorization:    skype_token {skypetoken}
Content-Type:     application/octet-stream


{the image file contents}

RichText/Sms

RichText/Files

RichText/Contacts

Sends a list of contacts to another client:

SDG 13 MSGR 921
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: RichText/Contacts
Client-Message-ID: 10829167517486132349
IM-Display-Name: User 1
Content-Type: application/user+xml
Content-Length: 134

<contacts alt="[Contacts enclosed. Please upgrade to latest Skype version to receive contacts.]">
  <c t="s" s="user3"/>
</contacts> 

There also seems to be the variant where t="p" and p="user3", not sure about the difference.

Control/Typing

Sends a typing notification

SDG 27 MSGR 656
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: Control/ClearTyping
Content-Type: Application/Message
Content-Length: 0

Control/ClearTyping

Clears typing notification

SDG 27 MSGR 656
Registration: ...base64 registration...

Routing: 1.0
To: 8:live:user1
From: 8:live:user2;epid={00155193-decb-dc89-95e0-43bd987ed463}

Reliability: 1.0

Messaging: 2.0
Message-Type: Control/ClearTyping
Content-Type: Application/Message
Content-Length: 0

Control/Inking

Control/LiveState

Signal/Audio

Signal/P2P

Signal/LogoffEndpoint

Signal/CloseIMWindow

Signal/ForceAbchSync

Signal/CloseRLPrompt

Signal/LogoffAllEndpoints

Signal/Turn

Signal/AudioMeta

Signal/AudioTunnel

Event/SkypeVideoMessage

Event/Call

Nudge

Wink

CustomEmoticon

Voice

Data

ThreadActivity

See Threads (Groupchats)

Clone this wiki locally