如何发布 Azure 机器人

How to Publish an Azure Bot

刚刚学习如何使用Azure Bot Service and Azure Bot Framework. I created a Bot in Azure portal following this Official Azure tutorial. Does this bot need to be published somewhere? I read somewhere that you Build-->Test-->Publish-->Evaluate. I've tested it in Azure portal itself as explained here。不确定它的发布部分。

您打算如何使用您的机器人? Azure 机器人通过将它们连接到现有渠道(如 Skype、Facebook Messenger、SMS 等)或从自定义应用程序进行 REST 调用来工作。

但是您也可以直接通过以下方式访问您的机器人:https://webchat.botframework.com/embed/YOUR_BOT_ID?t=YOUR_TOKEN_HERE

您可以使用此 HTML 标签将其嵌入任何网页:

<iframe src="https://webchat.botframework.com/embed/YOUR_BOT_ID?t=YOUR_TOKEN_HERE"></iframe>

请注意,这两种方法都会公开您的令牌,并允许其他开发人员也将您的机器人添加到他们的页面。

Bot ID 是您的 bot 的名称,您可以通过转到您的 bot 并选择 "Channel" blade 然后单击 "Get bot embed codes" link.

编辑:我继续写了一篇关于这个主题的博客 post https://medium.com/@joelatwar/how-to-embed-your-azure-web-app-bot-in-any-web-page-120dfda91fdc

您可以在这里找到信息Publish bot to BotService

希望对您有所帮助。

当您 create a web app bot in the Azure portal, an App service 为同一个机器人创建时。您可以通过转到创建机器人的 azure 资源组来检查这一点。现在网络应用程序确保的是,机器人已经在线(对全世界可用),因此它已经发布。

现在的下一个问题是,如何让其他人/用户使用机器人,这就是渠道的用武之地。将渠道视为一种媒介,通过它您可以让其他人使用您的机器人更好的用户体验。

有多个频道可用于发布机器人,是的,您可以在所有频道中发布同一个机器人。就像 Joel Guerra 提到的,webchat 只是一个频道,默认情况下启用的频道是:

  1. 在 Azure 门户中打开您的机器人,然后单击 Channels 边栏选项卡。
  2. 单击编辑 网络聊天 频道
  3. Secret keys 下,单击 Show 获取第一个密钥
  4. 复制密钥嵌入代码
  5. 单击完成

所以嵌入代码实际上是一个 iframe,您可以将其放置在您的网站中或与想要使用您的机器人的其他人共享。或者您也可以使用 iFrame 的 src 直接访问机器人。

同样,这只是一个频道。您可以查看 Configure channels 文档,了解在 Skype、Microsoft Teams、电子邮件、Facebook、Slack、Telegram 等更多渠道中启用机器人的步骤。