我正在尝试使用 Microsoft Bot Framework 构建一个机器人。我计划使用带有 Http 触发器的 Azure 函数作为端点。 NodeJS 是我选择的语言。我看到了带有 Restify 和 Nodejs 的 botframework 示例,但没有看到使用 azure 函数的示例。任何人都可以向我指出一个使用 azure 函数和 Nodejs 开发 botframework 的示例,或者给我一个如何执行此操作的示例。
最佳答案
来自克里斯·安德森...
https://github.com/christopheranderson/functions-bot-example
您需要将其连接到 HTTP 触发器,并使用以下代码进行集成。
var listen = bot.listen();
var response = function (context) {
return {
send: function (status, message) {
var _msg = message ? message : (typeof status !== 'number' ? status : null)
var _status = typeof status === 'number' ? status : 200
var res = {
status: _status,
body: _msg
};
context.res = res;
context.done();
}
}
}
module.exports = function (context, req) {
listen(req, response(context))
}
关于node.js - 带有 Azure Functions App 和 NodeJS 的 Microsoft Bot Framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40064918/