我在 AWS LEX 中创建了一个聊天机器人,并希望将它与 Skype 集成。有什么办法可以实现吗?
我已经在 Facebook、Slack 和 Twillo 上实现了它。
最佳答案
我正在尝试使用 LexRuntime ,
Microsoft Bot Framework和 AWS SDK for Javascript在 Node.js 中通过 Skype for business 实现 Amazon Lex。
您可以定义为:
var AWS = require('aws-sdk');
AWS.config.region = 'us-east-1';
var lexruntime = new AWS.LexRuntime({ apiVersion: '2016-11-28' });
var bot = new builder.UniversalBot(connector, function (session) {
console.log(session.userData);
var params = {
botAlias: '$LATEST', /* required */
botName: 'YourBotName', /* required */
contentType: 'text/plain; charset=utf-8', /* required */
inputStream: session.message.text,//new Buffer('...') || 'STRING_VALUE' || streamObject, /* required */
userId: 'username', /* required */
accept: 'text/plain; charset=utf-8',
sessionAttributes: session.userData /* This value will be JSON encoded on your behalf with JSON.stringify() */
};
console.log(params);
lexruntime.postContent(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else {
session.userData = data.sessionAttributes;
console.log(data); // successful response
session.send("%s", data.message);
}
});
});
我在 Microsoft 提供的模拟器上对此进行了测试,并从我的 Lex Bot 获得了响应。
您可以引用PostContent对于参数内容。
关于amazon-web-services - 将 AWS Lex 与 Skype 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44700448/