This is the very simple code using bot of GAS. e.g., /test hello -> bot: hello
But the error appears, why?
function doPost(e) {
array = e.parameter.text.split(" ");
if (array.length > 1) {
postSlack(array[1], e.parameter.user_id);
}
}
function postSlack(text, userId) {
var url = "incoming url";
var payload = {
text: "<@"+ userId + "> " + text
};
var options = {
"method" : "POST",
"headers": {"Content-type": "application/json"},
"payload": JSON.stringify(payload)
};
UrlFetchApp.fetch(url, options);
}
/test failed with the error "dispatch_failed"