This project updates your slack profile photo with a photo based on the weather.
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
andprofile_photos/jdoe_night.png
, for a slack configuration with name "jdoe". - Environment variables:
- Copy the
config.toml.template
file toconfig.toml
. - Edit the variables:
[weatherprovider]
section:name
: the name of the provider. Valid values areweatherstack
andweatherapi
.api_access_key
: the api key for your account on weatherstack.com or weatherapi.com.
[[slack]]
sections:name
: a name for your slack configuration.workspace
: the slack workspace where you want to change your profile phototoken
,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.
- Copy the
- 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 intotoken
in yourconfig.toml
file. - For the
cookie_d
env var, look at thecookie
header, and extract the value of thed=
part of the cookie.
- Copy the value of the
profile_photos_dir
: The directory containing your profile photos with the transparent background. it should contain ajdoe_day.png
for daytime, and ajdoe_night.png
for nighttime, for a slack configuration withname
"jdoe". the default location is inprofile_photos/
in the project.polling_interval_s
: The frequency in seconds to update the profile photo. The default value is7200
.
- Follow the setup described just above
- Setup a python environment
- Run
python -m wspp.main
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
- The night background photo is from Alexey Elfimov, 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.