Randomly determine facilitators for internal technical workshops using Slack slash commands.
This is a practice sample for D1 and Slack Slash Commands, so security and other considerations are not taken into account at this time.
npm install
npm run dev
npm run deploy
wrangler tail
wrangler d1 create facilitator
wrangler d1 execute facilitator --file=./schema.sql
refs https://api.slack.com/interactivity/slash-commands
https://facilitator.xxxxxx.workers.dev/facilitator
list / random / add xxx / del xxx / update xxx slack_user_id UXXX / dump
- commands
- chat:write
wrangler secret put SLACK_API_TOKEN
/facilitator list
/facilitator random
/facilitator add foo
/facilitator del foo
/facilitator update foo slack_user_id UXXXXX
/facilitator dump
wrangler d1 execute facilitator --command='select * from users'
$ curl -s -X POST 'https://facilitator.xxxxxxxx.workers.dev/facilitator' -d 'text=list'
kagamihara
ohgaki
shima
teckl
$ curl -s -X POST 'https://facilitator.xxxxxxxx.workers.dev/facilitator' -d 'text=dump'
[[2,"teckl","UXXXXTECKL","2023-07-30 16:58:52","2023-07-30 16:58:52"],[3,"kagamihara","UXXXXX","2023-07-30 17:00:44","2023-07-30 17:00:44"],[4,"shima","UXXXXXSHIMA","2023-07-30 17:00:53","2023-07-30 17:00:53"],[5,"ohgaki","UXXXOHGAKI","2023-07-30 17:01:17","2023-07-30 17:01:17"]]%
$ curl -s -X POST 'https://facilitator.xxxxxxxx.workers.dev/facilitator' -d 'text=random'
今回のファシリテーターは <@UXXXOHGAKI> ohgaki さんです。
よろしくお願いします。%
Cloudflare Workers + D1を使ってSlackのスラッシュコマンドを作ってみた
MIT
teckl https://github.com/teckl