如何通过特定的ts搜索消息

时间:2017-09-19 21:46:04

标签: slack-api

我正在尝试使用Slack API获取线程回复的父消息。当一个新的回复,它有一个" thread_ts"附在它上面,它与其父母的信息相关联。" ts"。我尝试使用ts作为查询进行搜索,但这并不起作用。我该怎么做?

1 个答案:

答案 0 :(得分:2)

使用channels.historyretrieving a single message上查看Slack的文档。此“从范围中选择1项”方法也应与其他渠道历史记录方法和conversations.history一起使用。

最简单的方法是将thread_ts值作为latest conversations.history参数提供给channel,并将包含的频道ID设为limit,并且1 *:history要求提供单个邮件。您需要相应的 GET /api/conversations.history?token=TOKEN_WITH_CHANNELS_HISTORY_SCOPE&channel=C2EB2QT8A&latest=1476909142.000007&inclusive=true&limit=1 范围来发出请求。

实施例: onInit: function() { var oData = { "Products": [ { "ProductID": 1, "ProductName": "Chai", "SupplierID": 1, "CategoryID": 1, "QuantityPerUnit": "10 boxes x 20 bags", "UnitPrice": "18.0000", "UnitsInStock": 39, "UnitsOnOrder": 0, "ReorderLevel": 10, "Discontinued": false } ] }; var oModel = new sap.ui.model.json.JSONModel(); oModel.setData(oData); this.attachModelEventHandlers(oModel); } attachModelEventHandlers: function(oModel){ oModel.attachPropertyChange(this.handlePropertyChanged, this); var binding = new sap.ui.model.PropertyBinding(oModel, "/", oModel.getContext("/")); binding.attachChange(this.handleDataChanged, this); }, handlePropertyChanged: function(oEvent) { // Do whatever here... } handleDataChanged: function(oEvent) { // Do whatever here... }