Skype bot created with skype-sdk in Node.js not working correctly?

I am trying to create a skype bot.

I followed the documentation specified by skype-sdk but could not create it using this. Unable to get response from bot.

 const fs = require('fs'); const restify = require('restify'); const skype = require('skype-sdk'); const botService = new skype.BotService({ messaging: { botId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx', serverUrl : "https://example.net", requestTimeout : 15000, appId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx', appSecret: 'xxxxxxxxxxxxxxxxxxxxxxxx' } }); botService.on('contactAdded', (bot, data) => { console.log("bot replay"); bot.reply('Hello ${data.fromDisplayName}!', true); }); botService.on('personalMessage', (bot, data) => { console.log("person replay"); bot.reply('Hey ${data.from}. Thank you for your message: "${data.content}".', true); }); const server = restify.createServer(); server.use(skype.ensureHttps(true)); server.use(skype.verifySkypeCert({})); server.post('/skbot', skype.messagingHandler(botService)); const port = process.env.PORT || 8080; server.listen(port); console.log('Listening for incoming requests on port ' + port); 

thanks

+6
source share
2 answers

In the above example, the bot does not connect to the skype server due to the wrong server:

 serverUrl : "https://example.net" 

You must specify a valid skype server:

 serverUrl : "https://apis.skype.com" 

You also specified the wrong uri API in server.post (well, that depends on the settings of your web hosting, but they were not provided, so I accept by default):

 server.post('/skbot', skype.messagingHandler(botService)); 

For messaging you should use '/v1/chat' . Try this tutorial .

+3
source

Build your bot with the Microsoft Bot Framework BotBuilder SDK instead of using skype-sdk .

You can create a basic Skype bot using the following code example:

https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/demo-skype/app.js

For a more detailed example of Skype features, check out the example of my Skype bot on GitHub here:

https://github.com/nwhitmont/botframework-skype-support-dev/blob/master/server.js

0
source

All Articles