简体   繁体   English

通过 AppId/BotId 注册 Azure Bot Service bot 时,Teams 如何知道它的端点?

[英]How does Teams know the endpoint of an Azure Bot Service bot when registering it via the AppId/BotId?

My bot is deployed to Azure's Bot Service, I enabled the Teams channel and I have successfully connected it to Teams.我的机器人已部署到 Azure 的机器人服务,我启用了 Teams 频道,并且我已成功将其连接到 Teams。 However, what I don't get is why it is working: :-)但是,我不明白它为什么起作用:-)

When setting up the bot in Teams' "App Studio", the UI looks like the screenshot below.在 Teams 的“App Studio”中设置机器人时,UI 如下图所示。 I don't use "Select from one of my existing bots", because the bot is deployed using a different user account.我不使用“从我现有的机器人之一中选择”,因为该机器人是使用不同的用户帐户部署的。 Instead, I paste just the AppId of the bot, using "Connect to a different bot id":相反,我只粘贴了机器人的 AppId,使用“连接到不同的机器人 id”:

在此处输入图像描述

My questions are:我的问题是:

  • How does Teams know what the endpoint of the bot is? Teams 如何知道机器人的端点是什么? Is it calling a global (?) bot registry somewhere using the ID as a key?它是否使用 ID 作为键在某处调用全局(?)机器人注册表?
  • Why does Teams not need the bot's password (when using the Bot Framework Emulator, app ID and password are required)?为什么 Teams 不需要机器人的密码(使用 Bot Framework Emulator 时,需要应用 ID密码)?
    • If I set MicrosoftAppId and MicrosoftAppPassword to non-empty strings in appsettings.json and run the bot locally, I must provide these credentials when using the Bot Framework Emulator, otherwise a 401 is returned.如果我在appsettings.json中将MicrosoftAppIdMicrosoftAppPassword设置为非空字符串并在本地运行机器人,则在使用 Bot Framework Emulator 时必须提供这些凭据,否则会返回 401。
    • If the bot is deployed to Azure and I connect Teams to it, I never specify the password (see my screenshot) but only the app ID .如果机器人部署到 Azure 并且我将 Teams 连接到它,我从不指定密码(参见我的屏幕截图),而只指定应用 ID Still, I can talk to the bot just fine through Teams.尽管如此,我仍然可以通过 Teams 与机器人交谈。
    • If you know my app ID, you can use my bot...?如果知道我的应用程序 ID,您可以使用我的机器人...?

[Me again:]) [又是我:])

Have a look at my blog post on how bots work 'under the covers' - it will explain how the back and forward works, and how the Bot Framework Services provide this 'glue', so to speak.看看我关于机器人如何“在幕后”工作的博客文章 - 它将解释后退和前进的工作方式,以及 Bot 框架服务如何提供这种“胶水”,可以这么说。

Answer to Question 1: When webservice is hosted, a messaging endpoint gets generated, which routes through the bot service.问题 1 的答案:托管 web 服务时,会生成一个消息传递端点,该端点通过机器人服务进行路由。 Webservice needs App ID and Password from your bot registration to get connected with. Webservice 需要您的机器人注册中的 App ID 和密码才能连接。

Answer to Question 2: Teams enables one to create/register bot in teams for testing purpose and the scope of the bot lies within the teams channel Since it is not a hosted one.对问题 2 的回答:Teams 允许一个人在团队中创建/注册机器人以进行测试,并且机器人的 scope 位于团队频道内,因为它不是托管的。

Teams app package with your app manifest, that you will install and App ID provided in it connects the Teams client to your web service, routed through the Bot Service. Teams 应用 package 与您的应用清单,您将安装它并在其中提供应用 ID 将 Teams 客户端连接到您的 web 服务,通过机器人服务路由。 Mainly, Teams app relies on App ID(unique Microsoft-generated identifier for app) to connect with your web service but not the password.主要是,Teams 应用程序依赖于应用程序 ID(Microsoft 生成的唯一应用程序标识符)来连接您的 web 服务,而不是密码。

If you have registered a bot via the Microsoft Bot Framework,you should already have an ID.如果你已经通过 Microsoft Bot Framework 注册了一个机器人,你应该已经有一个 ID。 Otherwise, you should generate a new ID then reuse it when you add a bot.否则,您应该生成一个新 ID,然后在添加机器人时重复使用它。

Both APP ID and Password would be mandatorily used for certain purposes like authentication. APP ID 和密码都将强制用于某些目的,例如身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM