如何为Microsoft Bot配置自定义终结点 [英] How to configure a custom endpoint for the Microsoft Bot

查看:56
本文介绍了如何为Microsoft Bot配置自定义终结点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在node.js中为我的机器人实现自定义终结点?对于C#,我也看到了同样的情况,但是它似乎是在node.js中实现的.

Is there a way to implement a custom endpoint for my bot in node.js?. I saw the same for C# but it seems to to be implemented in node.js.

以下是C#实现的链接:配置Botframework Bot的自定义端点

Here is the link to the C# implementation: Configure Custom Endpoint for Botframework Bot

部分原因是,门户中提供了一个选项,可以将机器人连接到azure功能,但我现在看不到.这是在步骤3上看到的帖子:

A part from this, in the portal there was an option to connect the bot to an azure function, but I don't see it now. Here is the post where is saw it, on the step 3: https://blogs.msdn.microsoft.com/waws/2018/04/22/azure-bot-function/

这里是实现和获取自定义终结点的C#代码,在Node.js中拥有它将是一件很棒的事情:

Here is the C# code to implement and get a custom endpoint, the one it would be great to have in Node.js:

httpConfiguration.MapBotFramework(botConfig =>
{
    botConfig.BotFrameworkOptions.Paths = new BotFrameworkPaths()
    {
        BasePath = "/bot",
        MessagesPath = "/john"
    };
});

推荐答案

请记住,聊天机器人只是一个Web应用.您可以自定义漫游器使用的端点,方法与为任何Web应用程序自定义端点的方式相同. Bot Builder节点.js示例通过Restify做到这一点:

Remember that a chat bot is just a web app. You can customize the endpoint that your bot uses the same way you would customize the endpoint for any web app. The Bot Builder Node.js samples do this with Restify:

// Listen for incoming requests.
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route to main dialog.
        await bot.run(context);
    });
});

如果您希望机器人在其他端点上进行侦听,则只需将/api/messages 更改为其他内容:

If you want your bot to listen on a different endpoint, all you have to do is change /api/messages to something else:

// Listen for incoming requests.
server.post('/bot/john', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route to main dialog.
        await bot.run(context);
    });
});

要解决您的其他问题,似乎不再可能创建新的功能bot,并且对它们的支持将很快失效:

To address your other concern, it appears to be no longer possible to create new functions bots, and support for them will soon expire: Is Functions Bot no longer a recommended Bot Service in Azure?

这篇关于如何为Microsoft Bot配置自定义终结点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆