从 Microsoft Bot Framework 发送松弛附件

Sending slack attachments from Microsoft Bot Framework

我正在尝试从这样的 Microsoft Bot 框架发送带有附件 (ref) 的 slack 消息。

    var message={
    "text": "I hope the tour went well, Mr. Wonka.",
    "response_type": "in_channel",
    "attachments": [
    {
        "text": "Who wins the lifetime supply of chocolate?",
        "fallback": "You could be telling the computer exactly what it can do with a lifetime supply of chocolate.",
        "color": "#3AA3E3",
        "attachment_type": "default",
        "callback_id": "select_simple_1234",
        "actions": [
            {
                "name": "winners_list",
                "text": "Who should win?",
                "type": "select",
                "data_source": "users"
            }
            ]
        }
    ]
};


session.send(message);

但它只呈现这个

I hope the tour went well, Mr. Wonka.

我不明白这是什么问题。

终于找到了方法,我的 JSON 中缺少 "channelData"。

    var message={"channelData":{
"text": "I hope the tour went well, Mr. Wonka.",
"response_type": "in_channel",
"attachments": [
{
    "text": "Who wins the lifetime supply of chocolate?",
    "fallback": "You could be telling the computer exactly what it can do with a lifetime supply of chocolate.",
    "color": "#3AA3E3",
    "attachment_type": "default",
    "callback_id": "select_simple_1234",
    "actions": [
        {
            "name": "winners_list",
            "text": "Who should win?",
            "type": "select",
            "data_source": "users"
        }
        ]
    }
]
}

};