node.js - 带有 Azure Functions App 和 NodeJS 的 Microsoft Bot Framework

标签 node.js botframework azure-functions

我正在尝试使用 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/

相关文章:

c# - TCP 服务器仅适用于 localhost 方案

node.js - 如何检查nodejs函数的结果?

azure - 代理设置是否会影响 Azure 机器人的工作?

azure - Azure Bot 服务的 Teams channel 的 IP 地址限制

javascript - 如何使用条件导入编写在浏览器和 Node 中都可以使用的 ESM 模块

javascript - Knex 迁移失败并显示 - SAVEPOINT can only be used in transaction blocks

c# - Azure Functions - 带文件的路由模板

azure - 无法使用 Azure Active Directory 持有者 token 对 Azure Functions 进行身份验证

c# - 微软机器人框架: did they change naming conventions between 2018 and 2020?

Azure Webjobs 控制面板?