问题
I'm writing a slack app which provides some stats about a service by demand using slash commands.
The command calls my web api, I calculate stuff and return a formatted JSON that slack parses as a message.
I would like to do the same but automatically, every day, at midnight.
What I could do is set up the scheduling in my own server and call a webhook, which would be fine except that I want my service to be simple, passive, stateless and just respond to requests.
Is there a way to set up recurring messages in a way that slack calls my API periodically?
回答1:
No. Slack does currently not provide a "scheduling" function in its API for calling an external service.
So you need to either use a local scheduling service (e.g. cron) on your server or an external web-based scheduling service. I personally use for my apps a free service called cron-job.org, which provides exactly the kind of functionality that you are requesting.
来源:https://stackoverflow.com/questions/52558957/recurring-daily-messages-to-a-specific-channel-by-my-slack-app