I created a google script linked to a spreadsheet that is designed to send a message to a slack channel thread when a cell is updated. The messages are posting fine to the channel, but I can't get the 'thread_ts' attribute to post the message as a reply to the specific thread as indicated by the timestamp for the parent message. I've read through the documentation several times. What I am doing wrong?
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)
}