I am working with slack command (python code is running behind this), it works fine, but this gives error
This slash command experienced a problem: 'Timeout was reached' (error detail provided only to team owning command).
How to avoid this ?
According to the Slack slash command documentation, you need to respond within 3000ms (three seconds). If your command takes longer then you get the Timeout was reached
error. Your code obviously won't stop running, but the user won't get any response to their command.
Three seconds is fine for a quick thing where your command has instant access to data, but might not be long enough if you're calling out to external APIs or doing something complicated. If you do need to take longer, then see the Delayed responses and multiple responses section of the documentation:
200
response immediately, maybe something along the lines of {'text': 'ok, got that'}
response_url
parameter. Make a POST
request to that URL with your follow-up message:
Content-type
needs to be application/json
{'text': 'all done :)'}
According to the docs, "you can respond to a user commands up to 5 times within 30 minutes of the user's invocation".