如何在发布到频道的帖子中提及使用CardFactory.adaptiveCard(NodeJS)的Bot(不是用户) [英] How do I mention a Bot (not a user) using CardFactory.adaptiveCard (NodeJS) in a post to a channel

查看:38
本文介绍了如何在发布到频道的帖子中提及使用CardFactory.adaptiveCard(NodeJS)的Bot(不是用户)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经遍历了interweb的所有四个角落,试图找到有关如何执行此操作的文档.但是到目前为止,我的旅程没有成功.在搜索的过程中,我能够找到如何提及用户(而不是机器人)的方法,这甚至很痛苦.我发现您必须在任意"广告的顶层发布一个名为 msteams 的字段.object参数,它是一个由实体数组组成的对象.该数组是对象数组.当提及一个具有适当值(代替用户名 userID )的用户时,adaptiveCard的以下用法适用:

I've scoured all four corners of interweb trying to find documentation on how to do this. But my journey has been unsuccessful so far. Part way through the search, I was able to find out how to mention a User (not a bot), and that was even a pain to find. I found that you have to post a field named msteams at the top level of the "any" object parameter which is an object consisting of an entities array. That array is an array of objects. The following use of adaptiveCard works when mentioning a user with the proper values replacing username and userID:

CardFactory.adaptiveCard({
  $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
  type: 'AdaptiveCard',
  msteams: {
    entites: [
      {
        type: 'mention',
        text: '<at>(username)</at>',
        mentioned: {
          id: <userID>,
          name: <username>,
          role: 'user'
        }
      }
    ]
  }
  body: [
    {
      type: 'TextBlock',
      text: '<at>(userName)</at>',
    }
  ]
});

The documentation of CardFactory.adaptiveCard just lists the parameter as an any Object and gives a small example not displaying an exhaustive list of fields of this parameter. It also posts a link to the Adaptive Card documentation, but that's what it's abstracting and the fields are not 1:1 (point and case this msteams object that is never referenced in the Adaptive Card documentation from what I can tell). I want to mention the bot itself that is posting this Adaptive Card. I've attempted to replace the mentioned object with the following

  {
      "id": "a3216960-131c-11eb-xxxx-xxxxxxxxx",
      "name": "Bot",
      "role": "bot"
  }

这等效于我用来提及"from"对象的对象.自适应卡中的用户.但这是收件人.成功提及的发件人用户格式如下:

This is equivalent to the object that I'm using to mention the "from" user in the adaptive card. But this is the recipient. The from user which is successfully mentioned is formatted like the following:

  {
      "id": "c3370a7c-95f2-4a60-xxxx-xxxxxxxxx",
      "name": "User",
      "role": "user"
  }

任何帮助/指导,技巧,参考都将不胜感激!

Any help/guidance, tips, references would be greatly appreciated!

推荐答案

当前,@提述不支持Adaptive卡中的机器人.您可以在自适应卡中@提及用户.

Currently @mention a bot in Adaptive card is not supported. You can @mention user in Adaptive card.

这篇关于如何在发布到频道的帖子中提及使用CardFactory.adaptiveCard(NodeJS)的Bot(不是用户)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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