-
Select or create a Cloud project with an App Engine app and enable billing, create a queue
-
Install Cloud SDK and configure
gcloud -
Configure the Slack app
3.1 Create the app =>
random-picker3.2 Request mandatory scopes:
chat:write,commands,usergroups:read,users:read3.3 Install the app
3.4 Create Slash commands (name and URL) =>
/randompicker,/randompickerlater
- Export env vars :
export SLACK_TOKEN=XXXwhere XXX isBot User OAuth Access Tokenfound in Slack app OAuth & Permissions pageexport PROJECT_NAME=XXXwhere XXX is the cloud project nameexport QUEUE_NAME=XXXwhere XXX is the queue nameexport LOCATION=XXXwhere XXX is the location (e.g.europe-west1)
- Install your app dependencies using the npm command:
npm install
- Run the app:
npm start
-
Replace env vars in
app.yaml -
In your terminal window, deploy the app to App Engine using the gcloud tool:
# on the command-line
gcloud app deploy
- Type the command into your Slack channel:
/randompicker @engineering: pick someone randomly in @engineering group
/randompickerlater @engineering in 5s: pick someone randomly 5s later
- Watch the logs to be sure the executions have completed
- La commande
randompickerlatern'est pas vraiment utile en tant que telle, le but était de créer une commande pour planifier une tâche cron qui appellerait le picker. GCP ne semble pas proposer d'option (Cloud Scheduler ?) pour planifier des tâches cron de manière programmatique (c'est pour ça que j'utilise ici des Cloud Tasks). A creuser... - ignore users option
- random with rotation (like Spotify)
- secure endpoints (OAuth?)
- control checks (e.g. endpoint parameters)
- call payfit API to ignore users in vacation => but no API!