I setup a custom slash command to store data into a Google Spreadsheet. Everything works perfectly (the script gets triggered and does its magic) except the respond takes too long (more than the given max of 3000ms) and Slack throws me a timeout error.
simplified google script:
function doPost(request) {
//// get data from slack payload
var params = request.parameters;
//// call a function with given parameters
custom_function(params);
////
var output = {"text":"SUCCESS"};
//// respond to slacks POST request
return ContentService.createTextOutput(JSON.stringify(output)).setMimeType(ContentService.MimeType.JSON);
}
Result:
Due to the long execution time of custom_function(); the end return ContentService. ... comes too late (past 3000ms timelimit) = timeout error in slack
Additional Info: I setup delayed responses with UrlFetchApp.fetch(url,options); with the code of custom_function(); - I am receiving those responses in Slack together with the timeout error.
Question: Is there any way I DON'T have to wait until custom_function(); is finished and send some HTTP 200 OK back immediately ? The doPost(); in my case doesn't need anything from custom_function in return to finish so why wait ... ?
THANKS !