我创建了一个链接到电子表格的Google脚本,该电子表格用于在更新单元格时向松弛通道线程发送消息。消息正好发布到频道,但是我无法获得'thread_ts'属性来将消息作为对父消息的时间戳指示的特定线程的回复发布。我已多次阅读文档。我做错了什么?
function myonEdit(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var columnOfCellEdited = range.getColumn();
if (columnOfCellEdited == 7) {
var url = "https://hooks.slack.com/services/xxxx/xxxx/xxxx" ;
var currentRow = sheet.getActiveCell().getRow()
var name = sheet.getSheetValues(currentRow, 1, 1, 1);
var payload = {
"username" : "robot",
"text" : name,
"icon_emoji": ":robot_face:",
"icon_url" : "http://image",
"thread_ts": "1511829070.000023"
}
sendToSlack_(url,payload)
}
}
function sendToSlack_(url,payload) {
var options = {
"method" : "post",
"contentType" : "application/json",
"payload" : JSON.stringify(payload),
};
return UrlFetchApp.fetch(url, options)
}