Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caarmen/weather-slack-profile-photo
Set your Slack profile photo to one based on weather conditiosn
https://github.com/caarmen/weather-slack-profile-photo
Last synced: 11 days ago
JSON representation
Set your Slack profile photo to one based on weather conditiosn
- Host: GitHub
- URL: https://github.com/caarmen/weather-slack-profile-photo
- Owner: caarmen
- License: mit
- Created: 2023-05-18T17:54:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-03T15:19:17.000Z (9 months ago)
- Last Synced: 2024-04-16T12:23:40.764Z (7 months ago)
- Language: Python
- Size: 5.19 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slack profile photo weather updater
This project updates your slack profile photo with a photo based on the weather.
## Configuration
You need to provide:
* Two profile photos, with 500x500 resolution, and with a transparent background, for daytime and nighttime. By default, place them in `profile_photos/jdoe_day.png` and `profile_photos/jdoe_night.png`, for a slack configuration with name "jdoe".
* Environment variables:
- Copy the `config.toml.template` file to `config.toml`.
- Edit the variables:
- `[weatherprovider]` section:
- `name`: the name of the provider. Valid values are `weatherstack` and `weatherapi`.
- `api_access_key`: the api key for your account on [weatherstack.com](https://weatherstack.com/) or [weatherapi.com](https://www.weatherapi.com/).
- `[[slack]]` sections:
- `name`: a name for your slack configuration.
- `workspace`: the slack workspace where you want to change your profile photo
- `token`, `cookie_d`: see below.
- `[wspp]` section:
- `latitude`, `longitude`: the location for the weather conditions that will be used to fill in the background in your profile photo.### Retrieving the slack token and cookie values
* Log into slack in a browser on a computer.
* Enable developer tools in the browser, and open the network tab.
* Manually change your profile photo to any photo you want.
* Inspect the request in the developer tools network tab on the `/api/users.setPhoto` endpoint.
- Copy the value of the `token` parameter into `token` in your `config.toml` file.
- For the `cookie_d` env var, look at the `cookie` header, and extract the value of the `d=` part of the cookie.### Optional parameters
* `profile_photos_dir`: The directory containing your profile photos with the transparent background. it should contain a `jdoe_day.png` for daytime, and a `jdoe_night.png` for nighttime, for a slack configuration with `name` "jdoe". the default location is in `profile_photos/` in the project.
* `polling_interval_s`: The frequency in seconds to update the profile photo. The default value is `7200`.## Running the program
* Follow the setup described just above### Locally
* Setup a python environment
* Run `python -m wspp.main`### With Docker
Retrieve the docker image:
```
docker pull ghcr.io/caarmen/weather-slack-profile-photo:latest
```Run the docker image. Indicate the host paths to your `config.toml` file and `profile_photos` folder.
```
docker run --detach -v `pwd`/config.toml:/app/config.toml -v `pwd`/profile_photos/:/app/profile_photos/ ghcr.io/caarmen/weather-slack-profile-photo
```## Image credits
* The night background photo is from [Alexey Elfimov](https://commons.wikimedia.org/wiki/File:%D0%A1%D0%B2%D0%B5%D1%82_%D0%BE%D1%82_%D0%B4%D0%B5%D1%80%D0%B5%D0%B2%D0%BD%D0%B8_-_panoramio.jpg), licensed under the Creative Commons Attribution 3.0 Unported license
* The weather background images were generated by Bing
* The sample profile photos were generated from the Bitmoji app.