向 MS Teams 频道发送主动自适应卡片消息 [英] Send Proactive Adaptive Card Message to MS Teams Channel

查看:43
本文介绍了向 MS Teams 频道发送主动自适应卡片消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试向 MS TEAMS 中的频道发送带有按钮的主动自适应消息卡,但我找不到任何解决方案.

REST API (

解决方案

根据希尔顿的推荐,我可以解决这个问题

您可以在这里设计自己的自适应卡片:自适应卡片设计并编辑 attachments.body 根据您的要求.

发送主动消息

方法:发布网址:https://smba.trafficmanager.net/{api}/v3/conversations/{channelId}/activities

作为机器人发送回复

方法:发布网址:https://smba.trafficmanager.net/{api}/v3/conversations/{channelId};messageid={messageid}/activities

<代码>{类型":消息",附件":[{"contentType": "application/vnd.microsoft.card.adaptive",内容": {"type": "AdaptiveCard",版本":1.0",身体": [{类型":文本块",大小":中",重量":更大胆",文字":文字"},{类型":文本块",尺寸":小",文本":文本",包装":真},],行动":[{"type": "Action.Submit","title": "接受",数据": {接受":真}},{"type": "Action.Submit",身份证":身份证",标题":标题",数据": {msteams":{类型":任务/获取",}}}]}}]}

I have been trying to send proactive adaptive message card with buttons to a channel in MS TEAMS, but I am not able to find any solution to this.

Any solution in REST API (https://smba.trafficmanager.net) or BotBuilder SDK for nodejs is appreciated.

解决方案

Based on recommendation from Hilton , I could figure out this

You could design your own adaptive card here: Adaptive Card Design and edit attachments.body as per your requirement.

sending a proactive message

METHOD: POST URL: https://smba.trafficmanager.net/{api}/v3/conversations/{channelId}/activities

sending reply as bot

METHOD: POST URL: https://smba.trafficmanager.net/{api}/v3/conversations/{channelId};messageid={messageid}/activities

{   
    "type": "message",
    "attachments": [
        {
       "contentType": "application/vnd.microsoft.card.adaptive",
       "content": {
        "type": "AdaptiveCard",
        "version": "1.0",
        "body": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "text"
            },
            {
                "type": "TextBlock",
                "size": "small",
                "text": "text",
                "wrap": true
            },
         ],
        "actions": [
            {
                "type": "Action.Submit",
                "title": "Accept",
                "data": {
                    "accept": true
                }
            },
            {
                "type": "Action.Submit",
                 "id": "id",
                  "title": "title",
                  "data": {
                    "msteams": {
                      "type": "task/fetch",
                    }
                  }
            }]
        }
        }
    ]
}

这篇关于向 MS Teams 频道发送主动自适应卡片消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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