Name randomizer for standups and on-call rotation slack message publisher
This code is for creating a webhook that triggers:
- Name list randomizer and publishes it to a URL
- Name rotation based on the week number of the year
- On the Slack menu, select
Tools > Workflow Builder
- Create a new Workflow and come up with a name
- Select Webhook from the list
- Add a variable as
text
r_list
for the random list endpoint.name
for the on-call endpoint.
- Add a new step after the Webhook
Send a message
- Pick the channel where you want to send the message
- Add a message and insert the previously created variable and save
- Publish it (top right button) and copy the
URL
because you'll need it later on
You can either use a serverless function already created by one of your teams or create a new one using a service like Vercel.
The idea is to use a cloud scheduler for running this task every morning or at the time of your daily. In the case of the on-call we like to run it every monday.
We're using Google Cloud Scheduler for this, but you could also use EasyCron
https://<cloud function service>/api?members=mario,luigi,peach&url=<URL-from-Slack>
Live url: https://random-daily.vercel.app/api/?members=mario,luigi,peach&url=
https://<cloud function service>/api/on-call?members=Name01,Mane02,Mane03&url=<URL-from-Slack>
Live url: https://random-daily.vercel.app/api/on-call?members=mario,luigi,peach&url=
Select manually
and added the time and days of the week we wanted this to be triggered.
Hit the test button after saving the cron job and check your slack channel.