【问题标题】:Sending slack attachments from Microsoft Bot Framework从 Microsoft Bot Framework 发送 slack 附件
【发布时间】:2018-05-07 20:17:57
【问题描述】:

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

    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.

我不明白这里有什么问题。

【问题讨论】:

    标签: botframework bots slack-api


    【解决方案1】:

    终于找到了方法,我的 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"
            }
            ]
        }
    ]
    }
    

    };

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-10
      • 1970-01-01
      • 2016-08-30
      • 1970-01-01
      • 1970-01-01
      • 2017-12-30
      • 1970-01-01
      相关资源
      最近更新 更多