您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

将机器人连接到通道Connect a bot to channels

通道连接机器人和通信应用。A channel is a connection between the bot and communication apps. 配置机器人以连接到希望在其上可用的通道。You configure a bot to connect to the channels you want it to be available on. 通过 Azure 门户配置的 Bot Framework Service 将机器人连接到这些通道,并促进机器人与用户之间的通信。The Bot Framework Service, configured through the Azure portal, connects your bot to these channels and facilitates communication between your bot and the user. 可以连接到许多常用服务,如 CortanaFacebook MessengerKikSlack 等。You can connect to many popular services, such as Cortana, Facebook Messenger, Kik, and Slack, as well as several others. 网上聊天通道已预配置。The Web Chat channel is pre-configured for you. 除了 Bot Connector 服务提供的标准通道,你还可以使用 Direct Line 作为通道,将机器人连接到你自己的客户端应用程序。In addition to standard channels provided with the Bot Connector Service, you can also connect your bot to your own client application using Direct Line as your channel.

可以借助 Bot Framework Service 规范化机器人发送到通道的消息,采用与通道无关的方式开发机器人。The Bot Framework Service allows you to develop your bot in a channel-agnostic way by normalizing messages that the bot sends to a channel. 这涉及将其从 Bot Framework 架构转换为通道架构。This involves converting it from the bot framework schema into the channel’s schema. 但是,如果通道不支持 Bot Framework 架构的所有方面,该服务会尝试将消息转换为通道支持的格式。However, if the channel does not support all aspects of the bot framework schema, the service will try to convert the message to a format that the channel does support. 例如,如果机器人向电子邮件通道发送的消息中包含一张带有操作按钮的卡,Connector 可能会将该卡作为一个图像发送,并包含这些操作作为消息文本中的链接。For example, if the bot sends a message that contains a card with action buttons to the email channel, the connector may send the card as an image and include the actions as links in the message’s text.

对于大多数通道,必须提供通道配置信息以在通道上运行机器人。For most channels, you must provide channel configuration information to run your bot on the channel. 大多数通道要求机器人在通道上具有帐户,而其他通道(如 Facebook Messenger)则要求机器人还需在通道上注册一个应用程序。Most channels require that your bot have an account on the channel, and others, like Facebook Messenger, require your bot to have an application registered with the channel also.

若要配置机器人以连接到通道,请完成以下步骤:To configure your bot to connect to a channel, complete the following steps:

  1. 登录到 Azure 门户Sign in to the Azure Portal.
  2. 选择要配置的机器人。Select the bot that you want to configure.
  3. 在“机器人服务”边栏选项卡,单击“机器人管理” 下的“通道” 。In the Bot Service blade, click Channels under Bot Management.
  4. 单击要添加到机器人的通道图标。Click the icon of the channel you want to add to your bot.

连接到通道

配置通道后,该通道上的用户便可以开始使用机器人。After you've configured the channel, users on that channel can start using your bot.

发布机器人Publish a bot

发布过程对于每个通道都是不同的。The publishing process is different for each channel.

CortanaCortana

机器人可以从仪表板发布到 Cortana,用于为 Cortana 技能提供支持。Bots are published to Cortana from the dashboard and are used to power Cortana skills. 发布机器人就是提交机器人进行审核。Publishing a bot submits it for review. Cortana 技能可以部署给你自己使用、部署给一个小组使用,或者发布给全世界使用。Cortana skills can be deployed for your own use, deployed to a small group, or published to the world.

SkypeSkype

机器人可以从配置页发布到 Skype。Bots are published to Skype from the configuration page. 发布机器人就是提交机器人进行审核。Publishing a bot submits it for review. 在审核之前,机器人有 100 个联系人的限制。Before review, the bot is limited to 100 contacts. 经审核的机器人没有联系人限制,你可以选择将机器人添加到 Skype 机器人目录中。Approved bots do not have limited contacts and you may opt to have the bot included in the Skype bot directory.

Skype for BusinessSkype for Business

Skype for Business 机器人可以由租户管理员注册到 Skype for Business Online 租户Skype for Business bots are registered with a Skype for Business Online tenant by a Tenant Administrator.

提示

若要查看审核状态,请在 Bot Framework 门户中打开机器人并单击“通道” 。To view the status of a review, open the bot in the Bot Framework Portal and click Channels. 如果机器人未获批准,则在提供结果时会提供原因链接。If the bot is not approved, the result will link to the reason why. 请进行必要的更改,然后重新提交需审核的机器人。After making the required changes, resubmit the bot for review.

其他资源Additional resources

SDK 包含可以用于生成机器人的示例。The SDK includes samples that you can use to build bots. 访问 GitHub 上的示例存储库即可看到包含示例的列表。Visit the Samples repo on GitHub to see a list of samples.