botframework - 从 Microsoft Bot Framework 发送 slack 附件
问题描述
我正在尝试从 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.
我不明白这里有什么问题。
解决方案
终于找到了这样做的方法,我的 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"
}
]
}
]
}
};
推荐阅读
- sql-server - 是否有用于在 sql 过程中比较产品版本的优化代码?
- r - 将因子“MM/YY”转换为 R 中的日期 YYYY-MM-DD
- python - 用于图像分析和生物信息学的 Python 代码
- c - 将虚拟内存映射到虚拟内存
- php - youtube视频下载问题错误和空查询问题
- latex - 在r markdown表中打印带有换行符的长字符值(到latex pdf)
- ios - 在 Swift 的谷歌地图中通过 Lat Long 获取地点 ID
- angular - Angular7 SSR、webpack 和 splitChunks
- php - PHP中来自TXT的回显字符串
- javascript - 如何等待变量具有值以便我可以执行其他代码?