通过 Curl 和 Incoming Webhook 创建 Slackbot 提醒

Create Slackbot reminder via Curl and Incoming Webook

我们使用 Incoming Webhook integration for Slack 来处理很多与聊天相关的事情。我想要做的是使用此集成将 Slackbot 提醒设置为服务器上 cron 作业的一部分。现在我的卷曲看起来像:

curl --data "/remind aparkin to do that thing in 45 mins" 'https://notmyrealteam.slack.com/services/hooks/slackbot?token=nottherealtoken&channel=%23testtesttest2'

但这只是将文本 /remind aparkin to do that thing in 45 mins 直接放入 #testtesttest2 房间,而不是创建提醒。

我知道 web api allows you to do this,但我真的很喜欢传入 webhooks 集成的便利性。

有什么想法吗?

不要认为您可以直接使用传入的 webhook 来做到这一点。

但是您可以开发一个小脚本(例如 PHP)作为您自己的 cron 脚本的 webhook。它只需要从您的url解析提醒参数,然后使用WEBAPI的remind method在Slack上设置提醒。