https://github.com/entur/officeplanner
This python script posts a message in multiple slack channels, and responds to the same message with 5 emojies that represent the weekdays.
https://github.com/entur/officeplanner
office planning self-hosted slack
Last synced: 10 months ago
JSON representation
This python script posts a message in multiple slack channels, and responds to the same message with 5 emojies that represent the weekdays.
- Host: GitHub
- URL: https://github.com/entur/officeplanner
- Owner: entur
- License: eupl-1.2
- Created: 2022-06-08T10:35:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-17T09:20:00.000Z (over 1 year ago)
- Last Synced: 2025-04-23T07:07:50.148Z (about 1 year ago)
- Topics: office, planning, self-hosted, slack
- Language: Python
- Homepage:
- Size: 51.8 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slack team location planner
We created a simple solution for getting a overview for planning when people in the team are coming into the office, without the need to introduce any new tools or complex 3rd-party slack applications.
This python script posts a message in multiple slack channels, and responds to the same message with 5 emojies that represent the weekdays.
The application is self-hosted and uses a Slack bot token, cron jobs can be created from CI tools like Github Actions / CircleCI Cron, run as a Kubernetes cron job or just be run locallly with python/docker.


## Onbarding
To add a new channel:
- Type `/invite atoffice` in the channel to grant permissions to the bot.
- Create a new PR.
- Enter channel name in `channels.txt`, create commit.
- Merge PR to main.
## Slack Bot configuration
You need to create a Slack app yourself at
Create a new Slack app, customize it as you prefer.
The bot requires the following **bot token scopes**:
- `chat:write`
- `reactions:write`
Install the bot to you slack organization after setting permissions, you will get a new slack bot token afterwards.
## Using the script
As a pre-requsite, you'll need to have 5 custom emojies representing each day in your slack organization. Without the emojies defined in the list below, the script will fail.
- `:monday:`
- `:tuesday:`
- `:wednesday:`
- `:thursday:`
- `:friday:`
> Example emojies can be found under the `examples/` folder.
To run the script you need two things, a `.txt` file containing name of the slack channels and a environment variable for the bot token.
### Python
If you are using python, then a `channels.txt` file should exist next to the `officeplanner.py` script and the `SLACK_BOT_TOKEN` must be populated in the same shell as the one running python.
### Docker
The latest docker image is available on github packages, and is updated when a PR is pushed to the `main` branch.
```yaml
ghcr.io/entur/officeplanner:main
```
Mount a `.txt` file to `/app/channels.txt` in the docker container.
Populate a `SLACK_BOT_TOKEN` environment variable with the token you got when creating the slack app.
## Bump versions manually
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install pip-tools
pip-sync
# bump versions in the requirements.in file
pip-compile
# test install the new versions
pip-sync
```