Giter Site home page Giter Site logo

skype-http's Introduction

Skype-Http

npm GitHub repository Codecov Build status Greenkeeper badge

Unofficial Skype API for Node.js via HTTP. This relies on the Skype Web Application and requires the credentials of the account you want to use: use it with care.

Installation

  • Stable version:

    npm install --save skype-http
  • Git master:

    npm install --save skype-http@next

Import for Typescript or Javascript ES6:

import * as skypeHttp from "skype-http";

Import for Javascript ES5:

var skypeHttp = require("skype-http");

Quick start

The code below sends Hello, World! to all of bob's contacts.

import { Api, connect } from "skype-http";

async function run() {
  const api: Api = await connect({credentials: {username: "bob", password: "hunter2"}});
  for (const contact of await api.getContacts()) {
    await api.sendMessage({textContent: "Hello, World!"}, contact.mri);
  }
}

run();

Running example

The demo will prompt you your username and password: you should use your Skype account (there is no support for Microsoft accounts for now).

git clone https://github.com/demurgos/skype-http
cd skype-http
# Ensure that you have the latest versions of the global dependencies
sudo npm install -g gulp-cli
npm install
npm start

This will perform a verbose connection (it should log the acquisition of various tokens), display the list of contacts, set the status to "Online" and start to respond to messages.

Documentation

Old API documentation for the version 0.0.13

At the moment, documentation generation no longer works (we're waiting for Typedoc 0.10). So I recommend to look at the example in src/example and library source code in src/lib, especially the api.ts file and types directory.

Help is greatly appreciated if you want to help with documentation.

For Typescript, you should import types using import { Contact } from "skype-http/types/contact", etc. (src/lib is the root of the published package).

Resources

If you just want to create a bot, take a look at https://github.com/Microsoft/BotBuilder first.

You can find the decompiled source code of the Skype Web Application on the skype-web-reversed repository.

What's not working and probably never will.

Project Background

This project started as a fork of the https://github.com/ShyykoSerhiy/skyweb after slow progress from 3rd party patches. The goal is to provide stronger guarantees about the objects returned by the API (through checks and normalization) and better error management, because scrapping/unofficial API calls are unreliable so the library should be resilient.

Disclaimer

This project relies on SkypeWeb Skype implementation. If Microsoft Corporation decides to remove Skype implementation (or change it in any) skype-http might not be in working state. Therefore it's not recommended to use it in any critical part of production code. In fact it's not recommended to use it in production at all.

MIT License.

skype-http's People

Contributors

aidanlovelace avatar demurgos avatar greenkeeper[bot] avatar grigori-gru avatar mitchcapper avatar robgraeber avatar shyykoserhiy avatar sorunome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

skype-http's Issues

Sanitize XML

The sendImage method uses an XML string. This string is currently built by concatenating the attributes inside the template. These attributes are not properly escaped currently.

We should either leverage cherio to build the string or add some utilities to better handle XML.

acceptContactRequest URI changed?

Hello, I keep getting
(node:16828) UnhandledPromiseRejectionWarning: net: Failed to accept contact

after using

const invites = await api.getContactInvites() console.log(${invites.length} pending invitation) await api.acceptContactRequest(invites[0].mri)

invites[0].mri is valid name, I added a console.log on accept-request-contact.js, its seems it retourn 404 page

Edit :
console.log(apiUri.authRequestAccept(apiContext.username, contactUsername))

is returning

https://api.skype.com/users/<myskype>/contacts/auth-request/<invites[0].mri id>/accept

so url seems correctly formated, but not working anymore?

Drop typings dependency

typings install --save npm:skype-http
typings ERR! message Unable to read typings for "request". The author of "skype-http" needs to check the entry paths in "package.json" are up to date
typings ERR! caused by ENOENT: no such file or directory, open 'C:\temp\skytest\node_modules\skype-http\node_modules\request\index.d.ts\index.d.ts'
typings ERR!

I am not a typings expert for how these imports normally go, it seems it reads from the local folder so not requiring a remote source to be updated. I am guessing it is because request does not have any typings locally. I am guessing modifying typings.json to specify the npm typings source (not sure why it doesn't pickup from package.json). I can investigate further if the immediate answer is not apparent to someone more familiar.

Handling when "Javascript is required" to login

Hi there.

Nice library! I like how verbose this error is -- it's very clear what the problem is. My question is whether or not dealing with this scenario is in scope of skype-http -- I'm assuming it is not:

For context, this is happening when logging in on a machine which has not logged into skype before through a normal client (i.e. I am guessing we are running into a security measure when Microsoft notices a login from a strange IP such as a virtual private server).

MicrosoftAccountLogin: Unable to login with MicrosoftAccount.
  caused by GetLiveToken: Unable to get the Live token for Skype
  caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\"Refresh\" content=\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\"/></noscript><title>Continue</title><script type=\"text/javascript\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\"javascript:DoSubmit();\"><form name=\"fmHF\" id=\"fmHF\" action=\"https://account.live.com/identity/confirm?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26contextid%3d20B63404CFB06BE2&mkt=EN-US&uiflavor=web&id=293290&uaid=ef101e26ba7ac7723c7241ecaca40cb1\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"ipt\" id=\"ipt\" value=\"Dfk7QGQf8!GGva9nb6r*2iXDtuYzpFtbqyInAWOdXUL*6GEcPBL!yWlm4koF!w1BByhraPWpkN7HdGaZ5nFvaugs7g5AxtaZD95BUmvmVyec9GqyRQcFJsP2POnu!avtdMFUwHRF54CdPc3yyqQMAcj6hQE*pTG2Pzxbql2W9emzQzTjE2k0i6RtyC1SNkH3e4bpWvCyTb0*ZV4Yov69k3Jm9CqJblo8pN3TdarmZoKwD8Bo0xgnujcEVcdqQjqX50gDUtq6P1udIjmYUv!WUZAUtNeluy*Yj7z!BIu8CZnoQjqOizc5WOyOl5MQMSn4KsdFiPye5XzJDSsK5iNUgz4aNmrPhPgC6OWohhYpOG!SkLRAHd1mMvDf*TxBhc2eHJDTVs6eK!rwjVbByXwbw0U6QMpnmvN84PEifvfqKfRn0pKSWYfkC1Md0hDPo8xTFHDQARpLXvl93AHCs1A3dII$\"></form></body></html>"
    at Object.create (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/microsoft-account/get-live-token.js:17:16)
    at scrapLiveToken (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:221:61)
    at /home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:138:20
    at Generator.next (<anonymous>)
    at fulfilled (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  name: 'MicrosoftAccountLogin',
  data: {},
  cause:
   { GetLiveToken: Unable to get the Live token for Skype
     caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in theMicrosoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\"Refresh\" content=\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\"/></noscript><title>Continue</title><script type=\"text/javascript\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\"javascript:DoSubmit();\"><form name=\"fmHF\" id=\"fmHF\" action=\"https://account.live.com/identity/confirm?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26contextid%3d20B63404CFB06BE2&mkt=EN-US&uiflavor=web&id=293290&uaid=ef101e26ba7ac7723c7241ecaca40cb1\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"ipt\" id=\"ipt\" value=\"Dfk7QGQf8!GGva9nb6r*2iXDtuYzpFtbqyInAWOdXUL*6GEcPBL!yWlm4koF!w1BByhraPWpkN7HdGaZ5nFvaugs7g5AxtaZD95BUmvmVyec9GqyRQcFJsP2POnu!avtdMFUwHRF54CdPc3yyqQMAcj6hQE*pTG2Pzxbql2W9emzQzTjE2k0i6RtyC1SNkH3e4bpWvCyTb0*ZV4Yov69k3Jm9CqJblo8pN3TdarmZoKwD8Bo0xgnujcEVcdqQjqX50gDUtq6P1udIjmYUv!WUZAUtNeluy*Yj7z!BIu8CZnoQjqOizc5WOyOl5MQMSn4KsdFiPye5XzJDSsK5iNUgz4aNmrPhPgC6OWohhYpOG!SkLRAHd1mMvDf*TxBhc2eHJDTVs6eK!rwjVbByXwbw0U6QMpnmvN84PEifvfqKfRn0pKSWYfkC1Md0hDPo8xTFHDQARpLXvl93AHCs1A3dII$\"></form></body></html>"
       at Object.create (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/microsoft-account/get-live-token.js:17:16)
       at scrapLiveToken (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:221:61)
       at /home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:138:20
       at Generator.next (<anonymous>)
       at fulfilled (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:4:58)
       at process._tickCallback (internal/process/next_tick.js:109:7)
     name: 'GetLiveToken',
     data: {},
     cause:
      { LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\"Refresh\" content=\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\"/></noscript><title>Continue</title><script type=\"text/javascript\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\"javascript:DoSubmit();\"><form name=\"fmHF\" id=\"fmHF\" action=\"https://account.live.com/identity/confirm?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26contextid%3d20B63404CFB06BE2&mkt=EN-US&uiflavor=web&id=293290&uaid=ef101e26ba7ac7723c7241ecaca40cb1\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"ipt\" id=\"ipt\" value=\"Dfk7QGQf8!GGva9nb6r*2iXDtuYzpFtbqyInAWOdXUL*6GEcPBL!yWlm4koF!w1BByhraPWpkN7HdGaZ5nFvaugs7g5AxtaZD95BUmvmVyec9GqyRQcFJsP2POnu!avtdMFUwHRF54CdPc3yyqQMAcj6hQE*pTG2Pzxbql2W9emzQzTjE2k0i6RtyC1SNkH3e4bpWvCyTb0*ZV4Yov69k3Jm9CqJblo8pN3TdarmZoKwD8Bo0xgnujcEVcdqQjqX50gDUtq6P1udIjmYUv!WUZAUtNeluy*Yj7z!BIu8CZnoQjqOizc5WOyOl5MQMSn4KsdFiPye5XzJDSsK5iNUgz4aNmrPhPgC6OWohhYpOG!SkLRAHd1mMvDf*TxBhc2eHJDTVs6eK!rwjVbByXwbw0U6QMpnmvN84PEifvfqKfRn0pKSWYfkC1Md0hDPo8xTFHDQARpLXvl93AHCs1A3dII$\"></form></body></html>"
          at Object.create (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/microsoft-account/get-live-token.js:17:16)
          at scrapLiveToken (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:221:61)
          at /home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:138:20
          at Generator.next (<anonymous>)
          at fulfilled (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:4:58)
          at process._tickCallback (internal/process/next_tick.js:109:7)
        name: 'LiveTokenNotFound',
        data: [Object],
        message: 'LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\\"Refresh\\" content=\\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\\"/></noscript><title>Continue</title><script type=\\"text/javascript\\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\\"javascript:DoSubmit();\\"><form name=\\"fmHF\\" id=\\"fmHF\\" action=\\"https://account.live.com/identity/confirm?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26contextid%3d20B63404CFB06BE2&mkt=EN-US&uiflavor=web&id=293290&uaid=ef101e26ba7ac7723c7241ecaca40cb1\\" method=\\"post\\" target=\\"_top\\"><input type=\\"hidden\\" name=\\"ipt\\" id=\\"ipt\\" value=\\"Dfk7QGQf8!GGva9nb6r*2iXDtuYzpFtbqyInAWOdXUL*6GEcPBL!yWlm4koF!w1BByhraPWpkN7HdGaZ5nFvaugs7g5AxtaZD95BUmvmVyec9GqyRQcFJsP2POnu!avtdMFUwHRF54CdPc3yyqQMAcj6hQE*pTG2Pzxbql2W9emzQzTjE2k0i6RtyC1SNkH3e4bpWvCyTb0*ZV4Yov69k3Jm9CqJblo8pN3TdarmZoKwD8Bo0xgnujcEVcdqQjqX50gDUtq6P1udIjmYUv!WUZAUtNeluy*Yj7z!BIu8CZnoQjqOizc5WOyOl5MQMSn4KsdFiPye5XzJDSsK5iNUgz4aNmrPhPgC6OWohhYpOG!SkLRAHd1mMvDf*TxBhc2eHJDTVs6eK!rwjVbByXwbw0U6QMpnmvN84PEifvfqKfRn0pKSWYfkC1Md0hDPo8xTFHDQARpLXvl93AHCs1A3dII$\\"></form></body></html>"\n    at Object.create (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/microsoft-account/get-live-token.js:17:16)\n    at scrapLiveToken (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:221:61)\n    at /home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:138:20\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:4:58)\n    at process._tickCallback (internal/process/next_tick.js:109:7)' },
     message: 'GetLiveToken: Unable to get the Live token for Skype\n  caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\\"Refresh\\" content=\\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\\"/></noscript><title>Continue</title><script type=\\"text/javascript\\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\\"javascript:DoSubmit();\\"><form name=\\"fmHF\\" id=\\"fmHF\\" action=\\"https://account.live.com/identity/confirm?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26contextid%3d20B63404CFB06BE2&mkt=EN-US&uiflavor=web&id=293290&uaid=ef101e26ba7ac7723c7241ecaca40cb1\\" method=\\"post\\" target=\\"_top\\"><input type=\\"hidden\\" name=\\"ipt\\" id=\\"ipt\\" value=\\"Dfk7QGQf8!GGva9nb6r*2iXDtuYzpFtbqyInAWOdXUL*6GEcPBL!yWlm4koF!w1BByhraPWpkN7HdGaZ5nFvaugs7g5AxtaZD95BUmvmVyec9GqyRQcFJsP2POnu!avtdMFUwHRF54CdPc3yyqQMAcj6hQE*pTG2Pzxbql2W9emzQzTjE2k0i6RtyC1SNkH3e4bpWvCyTb0*ZV4Yov69k3Jm9CqJblo8pN3TdarmZoKwD8Bo0xgnujcEVcdqQjqX50gDUtq6P1udIjmYUv!WUZAUtNeluy*Yj7z!BIu8CZnoQjqOizc5WOyOl5MQMSn4KsdFiPye5XzJDSsK5iNUgz4aNmrPhPgC6OWohhYpOG!SkLRAHd1mMvDf*TxBhc2eHJDTVs6eK!rwjVbByXwbw0U6QMpnmvN84PEifvfqKfRn0pKSWYfkC1Md0hDPo8xTFHDQARpLXvl93AHCs1A3dII$\\"></form></body></html>"\n    at Object.create (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/microsoft-account/get-live-token.js:17:16)\n    at scrapLiveToken (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:221:61)\n    at /home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:138:20\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/keyvan/code/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/providers/microsoft-account.js:4:58)\n    at process._tickCallback (internal/process/next_tick.js:109:7)' } }

Memory leak

There appears to be some kind of memory leak after running this for a longer period of time (only noticed after a few days)

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x55f2e3fefb6e [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::String::Flatten(v8::internal::Handle<v8::internal::String>, v8::internal::PretenureFlag) [node]
 8: v8::String::WriteUtf8(char*, int, int*, int) const [node]
 9: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [node]
10: node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&) [node]
11: void node::StreamBase::JSMethod<node::TLSWrap, &node::StreamBase::Writev>(v8::FunctionCallbackInfo<v8::Value> const&) [node]
12: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
13: 0x55f2e36f5236 [node]
14: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
15: 0x15935b1840bd

While right before that i get a bunch of

An error was detected:
{ poll: Unable to poll the messages
  caused by UnexpectedHttpStatus: Received response with the HTTP status code `404` but expected one of [200]. Request: {"uri":"https://db5-client-s.gateway.messenger.live.com/v1/users/ME/endpoints/SELF/subscriptions/0/poll","cookies":{"idx":{"skype.com":{"/":{"SC":{"key":"SC","value":"CC=:CCY=:LC=en:LIM=:TM=1500725790:TS=1500725790:TZ=:VAT=:VER=","expires":"2018-07-22T12:16:30.000Z","maxAge":31536000,"domain":"skype.com","path":"/","hostOnly":false,"creation":"2017-07-22T12:16:30.744Z","lastAccessed":"2017-07-22T12:16:34.025Z"}}},"login.skype.com":{"/":{"login-vi":{"key":"login-vi","value":"-snip-","domain":"login.skype.com","path":"/","hostOnly":true,"creation":"2017-07-22T12:16:30.745Z","lastAccessed":"2017-07-22T12:16:30.746Z"}}},"login.live.com":{"/":{"uaid":{"key":"uaid","value":"-snip-","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.279Z","lastAccessed":"2017-07-22T12:16:31.818Z"},"MSPRequ":{"key":"MSPRequ","value":"lt=1500725791&co=1&id=293290","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":true,"creation":"2017-07-22T12:16:31.280Z","lastAccessed":"2017-07-22T12:16:31.350Z"},"MSPOK":{"key":"MSPOK","expires":"1980-10-30T16:00:00.000Z","domain":"login.live.com","path":"/","httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.280Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"CkTst":{"key":"CkTst","value":"1500725791349","domain":"login.live.com","path":"/","hostOnly":true,"pathIsDefault":true,"creation":"2017-07-22T12:16:31.349Z","lastAccessed":"2017-07-22T12:16:31.350Z"},"PPAuth":{"key":"PPAuth","value":"-snip-","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"MSPShared":{"key":"MSPShared","expires":"1980-10-30T16:00:00.000Z","domain":"login.live.com","path":"/","httpOnly":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"MSPPre":{"key":"MSPPre","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"MSPCID":{"key":"MSPCID","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"WLOpt":{"key":"WLOpt","value":"credtype=1&act=[1]","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"MSPVis":{"key":"MSPVis","value":"$293290","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"LOpt":{"key":"LOpt","value":"1","domain":"login.live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"SDIDC":{"key":"SDIDC","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"},"MSPSoftVis":{"key":"MSPSoftVis","value":"@72198325083833620@:@","domain":"login.live.com","path":"/","secure":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"},"MSPBack":{"key":"MSPBack","value":"0","domain":"login.live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"}}},"live.com":{"/":{"PPLState":{"key":"PPLState","value":"1","domain":"live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T16:52:10.263Z"}}}}},"headers":{"RegistrationToken":"registrationToken=-snip-; expires=1500812190; endpointId={2b4a70a9-4ff3-493c-8371-d21e1b46f2c8}"}}, Response: [object Object]  
    at Object.create (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/http.js:21:16)
    at MessagesPoller.<anonymous> (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/polling/messages-poller.js:300:68)
    at Generator.next (<anonymous>)
    at fulfilled (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/polling/messages-poller.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
  name: 'poll',
  data: {},
  cause:

Where at cause it just keeps on repeating those.

Perhaps the polling is written in some recursive way which would also explain the memory leak? Is it handled already to automatically re-authenticate after your token expires?

skpy.core.SkypeAuthException: Token file has expired

Hi everyone, I am working with Skpy, I have used following code for two months, but this morning it suddenly returns this error
########################################################################
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\skpy\main.py", line 67, in init
self.conn.readToken()
File "C:\ProgramData\Anaconda3\lib\site-packages\skpy\conn.py", line 301, in readToken
raise SkypeAuthException("Token file has expired")
skpy.core.SkypeAuthException: Token file has expired
########################################################################
Here is my code:

import time
from pygame import mixer

while True:
localtime = time.localtime(time.time())
if localtime[3] >= 9 and localtime[3] < 16:
break
print("already break at " + str(localtime[3]) + ":" + str(localtime[4]))

i = 0
j = 0
k = 0

Skype('xxxx', 'xxxx', ".tokens-fred.2")
sk = Skype(tokenFile=".tokens-fred.2")

print(sk.conn)

print(sk.contacts["live:wyfbrowser"]) # the skype name of your contacts

print(sk.contacts["live:wyfbrowser"].chat)

mixer.init()
mixer.music.load("666.mp3") # the music should be under same folder with this file

while True:
j += 1
if j>8:
time.sleep(200)
ms = sk.chats["xxxx.ac"].getMsgs()
if len(ms)>= 10:
print("init..." + str(len(ms)))
elif len(ms)!=0:
if i != 0:
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print(ms)
mixer.music.play()
i += 1
else:
k += 1
print("checking..." + str(k))

Error thrown on getContacts

I get the following error when invoking api.getContacts()

TypeError: Cannot read property 'first' of undefined
    at contactToPerson (/home/keyvan/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/utils/formatters.js:114:68)
    at formatContact (/home/keyvan/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/utils/formatters.js:43:12)
    at arrayMap (/home/keyvan/matrix-puppet-skype/node_modules/lodash/lodash.js:660:23)
    at Function.map (/home/keyvan/matrix-puppet-skype/node_modules/lodash/lodash.js:9571:14)
    at Object.<anonymous> (/home/keyvan/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/api/get-contacts.js:29:18)
    at Generator.next (<anonymous>)
    at fulfilled (/home/keyvan/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/api/get-contacts.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:109:7)

Better support for unexpected responses

To provide guarantees about the interfaces of the objects returned by the API, we use a models for the responses and check the types at runtime (as of v0.0.14).
We would like this model to be relatively strict to detect API changes as quickly as possible and provide a faithful documentation of the data. This strict model combined with thrown errors on failure makes it currently hard to use the library in the face of unexpected responses due to changes.
A quick fix was merged to ignore extra keys.

To improve the situation, here is the approach I'd like to follow:

  • Step 1: Improve the error messages to be more actionable. The missing keys, invalid types and deserialization errors should better identify their position in the JSON document and the value causing the error. The deserialization should try to collect most of the errors instead of aborting on the first error (so we can have a shorter dev/test cycle). I wrote the deserialization and error libraries to support this kind of use case so this should be done relatively quickly.
  • Step 2: Ensure that consumers can override the deserialization either by passing a handler function or having an a useful error object exposing the JSON response. Both solutions could be mixed (handler to completely override the deserializer and error with data just to recover from unexpected responses). Another solution that may be cleaner could be to add a function exposing the raw response (something like .getContacts and .rawGetContacts).
  • Step 3: On error, issue a warning and automatically recover from the error. This kind of approach would work by having a strict model with extra hypothesis and a loose model that is guaranteed to work. We would first try to apply the strict model and fallback to the looser model. At this step, we would have a safe way to extend our model by pushing hypothesis to the strict model, trying it in real world situation and then updating the base model. It should be possible to handle warnings programmatically (it should not be hard coded as console.warn(...))
  • Step 4: Error report generation. To properly test the strict model, we need to run it in real-world situations and then get the feedback. We should provide helpers to handle the warnings and help collecting them. The most important part would be to sanitize the data by trying to remove any personal information so the consumer can post the report without having to sanitize it itself. Beyond that, helpful error messages recommending to submit warnings to this repo should help.

This kind of support will be rolled out over multiple versions but I wanted to write down the general direction for this part of the lib.

`api.getState` is not defined.

function login(){
  const statePath = sysPath.resolve(__dirname, "api-state.json");
  try {
    const stateContent = fs.readFileSync(statePath).toString("utf8");
    const apiContext = JSON.parse(stateContent);
    return skypeHttp.connect({
      state: apiContext,
      verbose: false
    });

  } catch (err) {
    return promptCredentials()
      .then((credentials) => skypeHttp.connect({
        credentials: credentials,
        verbose: false
      }));
  }

}

If I use this then in the resultant api object getState is not defined.

How to create a Skype-only live account?

This repo is pretty active but the demo doesn't function without an old account; what gives?

I have one as I registered it ages ago, but after some research it looks like you MUST have a MS Live account when you register for Skype.

Is there some gotcha to this?

update release and publish type bindings

Would be great if you could update the node npm package and publish an @types/skype-http package as well.

I tried doing things like:

"dependencies": {
		"skype-http": "git+https://github.com/ocilo/skype-http",

and then:

import { Api as SkypeApi } from "./node_modules/skype-http/src/lib/api";
import * as skypeHttp from "./node_modules/skype-http/src/lib/connect";
import * as events from "./node_modules/skype-http/src/lib/interfaces/api/events";

however ts-node doesn't support import so that fails (for the sub modules).

Could not get typings to install from repo using something like:
typings install --save github:ocilo/skype-http

These work:

npm install --save skype-http
typings install --save npm:skype-http

but are out of date I would assume.

invalid login error is cryptic

when you have an invalid login the error (even with a full BT) is a bit cryptic:

Unhandled rejection due to: [object Promise]={}: Error: Expected value of Skype token to be a string
    at Object.<anonymous> (C:\temp\skytest\node_modules\skype-http\dist\lib-es2015\lib\providers\lib\providers\microsoft-account.ts:77:11)
    at Generator.next (<anonymous>)
    at fulfilled (C:\temp\skytest\node_modules\skype-http\dist\lib-es2015\lib\providers\microsoft-account.js:4:58)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)

Do you want to try/catch on this to make it more apartent or better inspect the returned data to determine if it is a login failure? I can submit a PR if you want to specify direction.

getContacts undefined

I'm using Javascript and and I'm doing the following code

skypeHttp.connect(
        { credentials: {
            username: "**********",
            password: "***********"
        },
            verbose: true
        }).then(function(skypeAccount) {
            //var contacts = skypeHttp.Api.getContacts();
            var contacts = skypeAccount.Api.getContacts();
            response.send(200, JSON.stringify(contacts, null,2));
    }).catch(function(error) {
        var data = { error: "true", message: error.message};
        response.send(422,data);
    });

I get the following error

Cannot read property 'getContacts' of undefined

Am I doing something wrong?

Questions: Would you recommend this to replace 'skyweb'?

Hey!

I've noticed you were working on skyweb, but now you've created this fork. It appears you plan on working a bit on this. What's the current state of the library? Would you recommend this to replace skyweb?

I've had a few issues with skyweb not throwing catchable errors. Will you be implementing an 'error' event, and/or a 'disconnected' event?

Thanks,
Phil

Add to contact

Hello! How can i add new user using this API after he ask me for adding on Skype?

skype-http 0.1.0

I'll use this issue for the roadmap of the library until 0.1.0.

First of all, thanks for all the people using this library and reporting issues/sending PRs. I started the library about two years ago and since then the library was mostly maintained only to ensure that it keeps working, but this was not enough to move it beyond the prototype state.

Goals:

  • Abstract the network layer: HTTP requests (hosts, path, query strings and post body) and endpoint events (polling, websockets)
  • Offer safety guarantees for the return values and actionable errors
  • Provide enough features to potentially recreate a client with as many features as the the official client, minus audio/video.

Non-goals:

  • Provide a high-level interface hiding the peculiarities of Skype

Challenges:

  • We have no control about the API: the official Skype API may change at any moment.

Roadmap:

  • Remove the formatting layer trans translating the JSON responses sent by Skype's servers to a higher-level API (it can be seen with the two directories native-api and api). This kind of higher-level abstraction should be handled by other libraries.
  • Provide easier access for manual session management. A class automatically keeping track of the session could still be provided for ease of use, but it should be possible to pass the session state to method calls. The intent is to allow the API to be used in a REST server without having to keep track of active Api instances: you should be able to create a Skype session, save it to your storage layer and then reuse it when needed. skype-http currently offers a getState method to export the Skype session and endpoint state, but you then have to recreate a new instance (involving some reconnections) to use it.
  • Separate the Skype session from the endpoint state. The Skype session is used to work with contacts and conversation metadata. The endpoint is used to send and receive messages. Currently, both are created simultaneously and mostly kept in sync. The issue is that the endpoint tends to expire more quickly and require a different approach since it is oriented to deal with events.
  • Add support for websocket endpoints. We're currently using long-polling (every 1sec). Having the option to chose between websockets and polling would be nice (relies on the previous point: isolating the endpoint creation).
  • Improve detection of API changes. Most the library currently assumed some shape for the responses and crashed or returned inconsistent results in case of errors: this complicates handling of breaking API changes. To help with this, I wrote two libraries: Incident (stable) and Kryo (still moving). The goal of the first library is to easily create errors with unique names, corresponding data and track causality. Regarding skype-http, the goal would be to have any potential error defined in src/errors so you can then catch the errors, switch on the name and handle them with the available data. For example an unexpected Skype responses should result in an UnexpectedResponseBody error with a body and request data so you can implement a quickfix until a patch is merged into the library. The second library (Kryo) offers a mostly declarative API to build runtime representations of types. This allows to test if a value matches a given type and help with serialization. For example it's intermediate model is richer than JSON so it can deal with Date objects out of the box. It also supports renames between JS keys and serialized keys. These runtime types were introduced in #70 for contacts and #87 introduces it for conversations/messages/events. An idea to track Skype's non-breaking changes would be to generate two representations for each resource: a strict one rejecting objects with extra keys and using strong assumptions, and a weaker-one that ignore extra keys and has weaker checks. Then, the objects would be first parsed with strict representation: if it fails but succeeds with the weak one a warning is issued; if it also fails with the weak one it means there was a breaking change in the Skype API and an error is thrown as described above.
  • Add additional features: contact & conversation management, help with sending files
  • Drop dependency on request: its automagic cookie management makes it hard to keep track of the API state, it also complicates abstracting the HTTP layer to mock it.
  • Write some documentation: since the goal is to have a lower level lib, putting more time to write examples and document the API is needed. There is a tslint rule to help with documentation, it may help to enable it.
  • Add more tests: we recently enabled Codecov but the results are pretty bad. We should at least get to 80 or 90% of coverage.

connect through state very temperamental

For example calling after awaiting the connect:

fs.writeFileSync("state.json", JSON.stringify(await api.getState()));

then for when connecting doing:

let state = fs.readFileSync("state.json", 'utf8');
let api = await skypeHttp.connect({ verbose: true, state: JSON.parse(state) });

will periodically not connect properly, and will not throw an error either. I have added inside the normal connect T/C:
await api.setStatus("Online");
as if it doesn't connect right this command will fail.

skypeHttp.connect state resuming should always throw an error if resuming from state does not work (even if we have to make a no-op call after loading state to the skype service to make sure we are all good).

Send invite to conversation

Hello! Nice work) We use your project in matrix-skype-puppet. Is there any way to add someone from contacts to the chat group/conversation using your api? Maybe it's somehow possible by sending them 'share link' but I can't find how to get it?

Automatically register a new endpoint on expiration

If getMessages is not called for more than 2 minutes, the current endpoint is disconnected.

Trying to perform any call with the registrationToken leads to an error 404: {"errorCode":729,"message":"You must create an endpoint before performing this operation."}.

We should detect this kind of error and register a new endpoint.

skpy.core.SkypeAuthException: Token file has expired

Hi everyone, I am working with Skpy, I have used following code for two months, but this morning it suddenly returns this error
########################################################################
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\skpy\main.py", line 67, in init
self.conn.readToken()
File "C:\ProgramData\Anaconda3\lib\site-packages\skpy\conn.py", line 301, in readToken
raise SkypeAuthException("Token file has expired")
skpy.core.SkypeAuthException: Token file has expired
########################################################################
Here is my code:

from skpy import Skype
import time

i = 0
j = 0
k = 0

Skype('xxxx', 'xxxx', ".tokens-fred.2")
sk = Skype(tokenFile=".tokens-fred.2")

print(sk.conn)

while True:
j += 1
if j>8:
time.sleep(200)
ms = sk.chats["VIP"].getMsgs()
if len(ms)>= 10:
print("init..." + str(len(ms)))
elif len(ms)!=0:
if i != 0:
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print(ms)
i += 1
else:
k += 1
print("checking..." + str(k))

Image sending bug

Hello!

Link to SkPy issue

It's seems to me the best solution should be to add "X-Client-Version": "0/0.0.0.0" to headers in send-image.js. It helps me in my project, I can make pull request with it. But maybe there is some other problems which i can't catch.

Skype for business

Not working with my Skype for business account.

(node:21336) UnhandledPromiseRejectionWarning: MicrosoftAccountLogin: Unable to login with MicrosoftAccount.
  caused by WrongCredentials: Wrong credentials for the user "[email protected]"

Sending formatted text

i'm trying to make text bold (using asterisks) or italic (using underscores_) and send it to skype, but skype does not render it correctly. Is there a way how I can force text to be formatted when i'm sending it over skype-http ?

Thanks,
Alex

getContacts fails when the login is an email address

When the credentials use an email address ({username: "[email protected]", password: "bar"}), the getContacts api fails.

It sends a request to https://contacts.skype.com/contacts/v1/users/[email protected]/contacts and receives a 401 - Unauthorized response with the body:

{"message":"Skype token validation failed!","stackTrace":null}

In this case, it should have sent the request to https://contacts.skype.com/contacts/v1/users/live:example/contacts.

It means that there should be some translation between the email address and corresponding Skype username to fix this issue.

Update project tools

While working on other projects, I continually improved my project management tools. It resulted in turbo-gulp and a few shell scripts.
Some improvements are still planned (especially for documentation) but the bulk of the work is there so I'd like to start applying it to this project.

Compared to the version currently used by skype-http ([email protected]), the main changes are:

  • Simpler and more declarative configuration
  • Documentation generation with Typedoc
  • Type-aware Tslint rule
  • Support creation of packages providing deep imports (import {Api} from "skype-http/types")
  • Helpers for deployment to npm and Github pages
  • Update most of the dependencies to their latest version

And a few other goodies. I am actively working on ESM modules support for Node (.mjs) so it should hopefully land there soon.

Additional changes that need to be done manually:

  • Enable Continuous Deployement: Reuse this script. It adds continuous deployment of the package to npm and documentation to Github pages.
  • Add a link somewhere in the README to the available tasks

lots of ECONNRESET issues

Looking at the logs it seems that in april this would happen at a maximum a few times a day (and on average maybe once every few days)
"An error happened while processing the polled messages":
Error: read ECONNRESET
at exports._errnoException (util.js:1050:11)
at TLSWrap.onread (net.js:581:26)

However recently it has become near constant. Upon connect it can almost certainly occur (sometimes during the login itself). Reconnecting right away using the new token also fails falling back to user/pass.

Using a proxy through the same server the web client does not exhibit similar behavior (all poll requests are successful).

can't get display name of bots

i'm using the "getConact" method to get the details of a bot user, and the display name is empty.
is there a different way to get the display name?

Email login does not work and model errors

When you login with email, it sets the context username to the email so that getting contacts fails in addition to anything that depends on the username.

{
    "username": REDACTED"@outlook.com",
    "skypeToken": {
        "value": REDACTED,
        "expirationDate": REDACTED
    },
    "registrationToken": {
        "value": REDACTED,
        "expirationDate": REDACTED,
        "endpointId": "{78ee4110-26ee-42f1-b487-10e6de41228c}",
        "raw": "registrationToken="REDACTED,
        "host": "bn2-client-s.gateway.messenger.live.com"
    }
}

Unable to login with MicrosoftAccount

I started receiving the following error last night. My account is no longer able to log in to skype using this library. Is it possible that the api has changed?

Unable to login with MicrosoftAccount.
MicrosoftAccountLogin: Unable to login with MicrosoftAccount.
  caused by GetLiveToken: Unable to get the Live token for Skype
  caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\"Refresh\" content=\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033&uaid=08766b033f8f450ca7ad755e627193ec&client_flight=ReservedFlight33,ReservedFligh\"/></noscript><title>Continue</title><script type=\"text/javascript\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\"javascript:DoSubmit();\"><form name=\"fmHF\" id=\"fmHF\" action=\"https://account.live.com/apps/upsell?app=Authenticator&mkt=EN-US&uiflavor=web&id=293290&ru=https://login.live.com/login.srf%3fid%3d293290%26opid%3d8F099F11057090DA%26opidt%3d1552929230\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"client_flight\" id=\"client_flight\" value=\"ReservedFlight33,ReservedFligh\"><input type=\"hidden\" name=\"ipt\" id=\"ipt\" value=\"DU3HcN59A5aRRYHqRRY!A7pxEWFw7LWZ4Y!x1yNGsFfbHZTi4NIQPsjCeI*g21R3HB*lLAj9F9HHIdB8KQr9LFL2ETp46pT!YObubWX5Oma*DxSCS!W5M9r2mTqumIukKtjnu4hKqBFOW3uvPdVlkieVYhel1QiB3ZmwIMfTrHsbdh!Ogf8zDuFjTygkJYAIXU8cefAMOu62BXdHzGJu!yAEoI8MVJ4Gw6yq5ZrIu*tYzQ*4sPFLU8KynDh7fiDBF6Pf*8kiod0oiLkA47MlPT*!8k8mfTNHxoLCa5waRMNjDBtCZ7lq00rdTPxASLhdZvWlnv2d*bafEmrwnrwjKfdgMHVZaiGPdYLPFu7KPeUVsAb60pRs7eIRLMGmIAqM*NucQM088OjlZICfXU8hPuuHPvYuxkRxrdRJErU!VZ3eo*wqxgQdNhulH4E*Sf3mUx17KJZNLhYbuH*54FcJlFIMs9es0zqOX!fQRxc!P78s\"><input type=\"hidden\" name=\"pprid\" id=\"pprid\" value=\"e152605252064532\"><input type=\"hidden\" name=\"uaid\" id=\"uaid\" value=\"08766b033f8f450ca7ad755e627193ec\"></form></body></html>"

Cannot read property 'join' of undefined path.posix

I am getting an error when trying to login: (in microsoft-account.ts @116)

export async function getLiveKeys(options: LoadLiveKeysOptions): Promise<LiveKeys> { try { const uri: string = url.resolve(skypeLoginUri, path.posix.join("oauth", "microsoft"));

For some reason path.posix is undefined. I have the latest version of node.js. Any ideas why this would be the case?

Not compatible with typescript 3

It is not possible to compile a program using skype-http and typescript 3. The reason is that you are using an old version of kryo that includes *.ts files in the package. And these *.ts files are now no longer compilable with standard tsconfig compiler options. I am attaching a package.json and index.js that illustrates the problem.

To reproduce:

  1. download both files into a new directory
  2. npm i
  3. ./node_modules/.bin/tsc

You will get a bunch of compile errors like the ones in compilation-results.txt in the sample project.

To fix this, I believe you will have to upgrade to the latest kryo version, but looks like there are API changes to handle as well.

Sample project.zip

Update README.md

Since v0.0.5, the rewrite of library is almost finished.
We should update the REAMDE.md to reflect the current state of the package.

support editMessage and removeMessage

Reference: ShyykoSerhiy/skyweb#19

  • URI: https://{host}/v1/users/{user}/conversations/{conversationId}/messages
  • Body:
{
    content: editedContent // empty string to remove
    contenttype: "text"
    messagetype: "RichText"
    skypeeditedid: "4059726727402763698" // clientmessageid
}

Unable to login with MicrosoftAccount


node:3103) UnhandledPromiseRejectionWarning: MicrosoftAccountLogin: Unable to login with MicrosoftAccount.
  caused by GetLiveToken: Unable to get the Live token for Skype
  caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<!-- Copyright (C) Microsoft Corporation. All rights reserved. --><!DOCTYPE html><!-- ServerInfo: BY1PPF45C32AC58 2019.12.11.17.32.58 Live1 Unknown LocVer:0 --><!-- PreprocessInfo: azbldrun:AzBuildCU-Ha11, 2019-12-11T17:27:10.0518177-08:00 - Version: 16,0,28426,6 --><!-- RequestLCID: 1033, Market:EN-US, PrefCountry: US, LangLCID: 1033, LangISO: EN --><html dir=\"ltr\" lang=\"EN-US\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><meta http-equiv=\"X-U


Unable to login with MicrosoftAccount

When I authenticate with email & password. I got the error message like this

(node:25289) UnhandledPromiseRejectionWarning: MicrosoftAccountLogin: Unable to login with MicrosoftAccount.
  caused by GetLiveToken: Unable to get the Live token for Skype
  caused by LiveTokenNotFound: Unable to find the Live token. This token is normally found in the HTML response as the value of the element with the id "t". This error may be caused by a change in the Microsoft login workflow. HTML page: "<html><head><noscript>JavaScript required to sign in<meta http-equiv=\"Refresh\" content=\"0; URL=https://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033\"/></noscript><title>Continue</title><script type=\"text/javascript\">function OnBack(){}function OnNext(){}function DoSubmit(){var subt=false;if(!subt){subt=true;document.fmHF.submit();}}</script></head><body onload=\"javascript:DoSubmit();\"><form name=\"fmHF\" id=\"fmHF\" action=\"https://account.live.com/profile/accrue?ru=https://login.live.com/login.srf%3flc%3d1033%26sf%3d1%26id%3d293290%26tw%3d18000%26fs%3d0%26ts%3d-1%26sec%3d%26mspp_shared%3d1%26seclog%3d10%26claims%3d%26wa%3dwsignin1.0%26wp%3dMBI_SSL%26ru%3dhttps://lw.skype.com/login/oauth/proxy%253fclient_id%253d578134%2526site_name%253dlw.skype.com%2526redirect_uri%253dhttps%25253A%25252F%25252Fweb.skype.com%25252F%26scft%3dDbdixGEEsYVYtSMRexvtSGz9dkNyQGDZqkClix2G*znkYP0Hh*qQBICgyxa4nloaROWzMeZ1Olo2J8iVNX14EPDHkItfZyFEUxFcDbgXPrQcHRcrEVrEbV*wM3*gEnwpTZIiDqV7sMXApnlOM3R*yQad!nbKO4gJwGsguQc4TJjqgiQkZUyZ5GGWpDkqf3HOkpMi30USNdGg4E5VxONytUg%2524%26contextid%3d1421ED09C4944B7A&mkt=EN-US&uiflavor=web&id=293290&uaid=bd7e9c2899ec4619ba5eebe1dc1c5189&if=80000000&af=20&saf=0\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"ipt\" id=\"ipt\" value=\"DVgh6HqomK5mjRaCJ3kLLyDwHwx7!20*wDdWEaSXAg!1SM15T8OkkASM6*sxwzkaDHexcYGIKM25!8GwSj05TnJA!UhFFP!DjKkncKG!pMUR*DCiPVSDo5Eo2vou6fSOWKtcjWEzzocvKbDbSaIvG!fodZMcvVQtZqVTInrOh!67c1bN2dC1pa*Q8eSMQ1LoEZ6IdF0n0uTKcNOLaAhNOM!gi7VHft4jOp36xYOjDwCk02CJVQ5wYMqHJXjyl3fT1lKTp!dHPnGgvBZOiWqfroaSxbl0cUmlycEySH6Q8Sve*NRp0F98KBYYAb*nhh*Upf8MsosizDC7mT!GMxC3qiZPAPe2rJs7iINpnBpsXXhytoGswCeLa2RUq75JaQdmSrJbeisUSYREnsXfIBi5Zj42rWUMXG27iqgGzAeCJ2HX6OR4F14TneU5I!Q1CJZHAaPDitV5FN31vkCBmGMaXMKEpkksUKvC2g3OSdSXGs2N\"><input type=\"hidden\" name=\"pprid\" id=\"pprid\" value=\"5ea9cd736ac21d19\"></form></body></html>"
    at Object.create (/home/devops/grablingo-api/node_modules/skype-http/errors/microsoft-account/get-live-token.js:17:16)
    at scrapLiveToken (/home/devops/grablingo-api/node_modules/skype-http/providers/microsoft-account.js:216:61)
    at getLiveToken (/home/devops/grablingo-api/node_modules/skype-http/providers/microsoft-account.js:138:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:25289) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25289) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is the code I used:

  const api = await connect({
    credentials: {
      username: process.env.skype_email,
      password: process.env.skype_password,
    }
  });

It ran successfullly on my local computer. But when I deployed it on DigitalOcean (a server service). It raised the above error.

I have no idea how to deal with it. Any suggestions for me?

VS2017 prevents from setting the encoding in .editorconfig

#36 added project files for Visual Studio 2017.

Ideally, the project should be independent of the IDE / editor. The current project files have hard-coded directory paths and forced us to comment the editorconfig setting for encoding. This is not an ideal solution but at least it allows to work with VS2017. I'd like to keep this issue open until the issue is fixed in VS2017.
If you use VS2017, please let me know if the project and solution files are still needed.

An in-range update of @types/request is breaking the build 🚨

The dependency @types/request was updated from 2.48.0 to 2.48.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/request is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Error

Acquired SkypeToken
Acquired RegistrationToken
{ net: Unable to subscribe to resources: statusCode: 403 body:
at /laptop/node_modules/skype-http/dist/lib-es2015/lib/login.js:163:35
at Generator.next ()
at fulfilled ( /laptop/node_modules/skype-http/dist/lib-es2015/lib/login.js:4:58)
at process._tickCallback (internal/process/next_tick.js:109:7) name: 'net', data: {} }

Potential problem in api.ts

In the following snippet you can see that it is assumed that ev.resource.from.username is defined, but then, the existence of ev.resource is checked. So if ev.resource is definitely there, why check for it? Should the conditional be changed, then, to not assume ev.resource.from.username is a true object path in every event?

For context, I am looking at this because I'm actually interested in self-sent messages. I'm puzzled as to why there is a comment here saying there would be an infinite-loop. I'm using the generic event event in order to pick up self-sent messages now as a result, although I'd have preferred the Text/RichText ones.

skype-http/src/lib/api.ts

Lines 93 to 101 in 08666d1

// Prevent infinite-loop (echo itself)
if (ev.resource.from.username === this.context.username) {
return;
}
if (ev && ev.resource && ev.resource.type === "Text") {
this.emit("Text", ev.resource);
} else if (ev && ev.resource && ev.resource.type === "RichText") {
this.emit("RichText", ev.resource);

    // Prevent infinite-loop (echo itself)
    if (ev.resource.from.username === this.context.username) {
      return;
    }

    if (ev && ev.resource && ev.resource.type === "Text") {
      this.emit("Text", ev.resource);
    } else if (ev && ev.resource && ev.resource.type === "RichText") {
      this.emit("RichText", ev.resource);

getContacts returns only a dozen contacts

async function run() {
  const api: Api = await connect({credentials: {username: "", password: ""}});
  for (const contact of await api.getContacts()) {
  console.log(contact);
 }
}

Returns only perhaps a dozen contacts. Do you know how a "contact" is defined by Skype? I have hundreds of contacts and I'm curious if I need to use paging or something to work through them all?

Thanks for this.

Not authorized to get the contact

A change in the Skype API caused a regression in the library. The library is no longer able to fetch the contact data. This can be seen by running the example. We get a large number of errors of the following form:

{ statusCode: 403,
  body: '{"status":{"code":40300,"text":"User \'<local-username>\' is not authorized to request resource of user \'<contact-username>\'"}}',
  headers: 
   { server: 'nginx/1.7.8',
     date: 'Tue, 09 May 2017 19:29:31 GMT',
     'content-type': 'application/json; ver=1.0; charset=utf-8',
     'content-length': '118',
     connection: 'close',
     'x-stratus-processing-time': '0.0188',
     'x-skype-request-id': '7ee0275d',
     'x-stratus-request-id': '7ee0275d',
     'cache-control': 'no-cache, must-revalidate, stratus-cache-per-request=true',
     'x-frame-options': 'SAMEORIGIN',
     'x-content-type-options': 'nosniff',
     'x-xss-protection': '1; mode=block',
     'strict-transport-security': 'max-age=31536000; includeSubdomains;' } }
{ net: Unable to fetch contact
    at Object.<anonymous> (/data/projects/various/skype-http/build/example/lib/api/get-contact.js:33:35)
    at Generator.next (<anonymous>)
    at fulfilled (/data/projects/various/skype-http/build/example/lib/api/get-contact.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:109:7) name: 'net', data: {} }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.