Reputation: 2019
I'd like to develop a skype bot that would take user name as input and say hello username
in the opposite char case based on the user input. In brief, if the user types his name as james
, my bot would respond to him as Hello JAMES
. The program runs fine, however I am finding it ambiguous to integrate my textbot program to skype bot.
Here's my code:
var builder = require('botbuilder');
var helloBot = new builder.TextBot();
helloBot.add('/', [
function (session, args, next) {
if (!session.userData.name) {
session.beginDialog('/profile');
} else {
next();
}
},
function (session, results) {
session.send('Hello %s!', session.userData.name);
}
]);
helloBot.add('/profile', [
function (session) {
builder.Prompts.text(session, 'Hi! What is your name?');
},
function (session, results) {
if(results.response == results.response.toUpperCase())
{
//console.log("in if");
session.userData.name = results.response.toLowerCase();
}
else
{
//console.log("else");
session.userData.name = results.response.toUpperCase();
}
session.endDialog();
}
]);
console.log("Hi!");
helloBot.listenStdin();
The output would be like :
bot : Hi
user: Hello.
bot : What is your name?
user: james.
bot : Hello JAMES.
Upvotes: 1
Views: 84
Reputation: 4655
To create a chat bot compatible with Skype, use the UniversalBot
type instead of TextBot
. You can find sample code that demonstrates how to send different card types in BotBuilder-Samples/Node/cards-RichCards.
To configure your bot to work with Skype, login to the Bot Portal at https://dev.botframework.com and register your bot. After your bot is registered, go to 'My bots', click on your bot name, and you will see the 'Channels' section with Skype and WebChat enabled by default. Under 'Test link', click the 'Add to Skype' button. This will redirect you to the Skype website where it will ask you to confirm that you want to add the Skype bot to your Skype contacts.
For more information on Skype bots check out the Getting Started Guide.
Upvotes: 1