Skip to main content

Slack Timezoner

If you use slack, it's sometimes useful to get an idea of the geographic distribution of members.

And because we're online, while geographic distance is important to know it's often the timezone that's more relevant for working out when might be sensible to contact someone, or see how a commmunity is distributed.

This is what slack timezoner does. Right now all it does is print out a count of members in your community, by timezone.

## Usage

  1. Create an app for a single slack group
  2. Get a Web API token - https://api.slack.com/web#authentication
  3. Checkout this code
  4. Install dependencies
  5. Either use the code programatically, or run it this as a server, to see the JSON output

Create an app

You need to create an app for a single team. See below for more

https://slack.dev/python-slackclient/auth.html#

You can create an app at the link below:

https://api.slack.com/apps

Get a web api token

This is detailed in slack's extensive documentation. You need a Web API token

https://api.slack.com/web#authentication

If it helps it should be visible at a link that looks like the pattern below, and it will be called OAuth Access Token in the web UI:

https://api.slack.com/apps/YOUR_APP_ID/oauth

Check out this code

Use the code programatically, or run the server

This project includes a minimal, single-file Django app, to serve the summary as JSON, to display using some charting or tabular renderer.

python ./minimal.py runserver

Alternatively, you can also import the library and use it programatically in python code:

import slack_timezoner.group_by_timezones

tzc = group_by_timezones.TimeZoneCounter()

# returns a Counter datastructure
res = tzc.summary()

Next steps

This was thrown together in a hurry, and I'd like to adapt this to allow running the same kind of summaries for any public channel in slack workspace.

You can list all the channels in workspace with this API call: https://api.slack.com/methods/conversations.list

Once you have that, you can get a list of the members like so: https://api.slack.com/methods/conversations.members

This returns a list of member ids like so:

{
    "ok": true,
    "members": [
        "U023BECGF",
        "U061F7AUR",
        "W012A3CDE"
    ],
    "response_metadata": {
        "next_cursor": "e3VzZXJfaWQ6IFcxMjM0NTY3fQ=="
    }
}

You can then look up the timezones, with this call to recontruct a datastructure similar to the one used in the TimeZoneCounter already.

https://slack.dev/python-slackclient/basic_usage.html#listing-team-members

Contributing

This is currently used in the ClimateAction.tech slack. If you're interested in helping out, please file an issue, or join the slack there.

You can join the link below:

https://climateaction.tech/#join

Metadata

Release files for slack-timezoner 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slack-timezoner 0.1.3
File Size Uploaded Provenance
slack-timezoner-0.1.3.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for slack-timezoner 0.1.3
File Interpreter ABI Platform
slack_timezoner-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / slack-timezoner-0.1.3.tar.gz

Download URL slack-timezoner-0.1.3.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fc44dbf3f34ae25f7643e2583c0abdf8d3999ac867af5858f7ef20c3a0120b65
BLAKE2b-256 checksum
How to use checksums
4c38f8f0dc6e455a8f0ea33e50ab2d919ed53e898b4f810f65facbba1434c1cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.6.10 Darwin/19.6.0

Release files / slack_timezoner-0.1.3-py3-none-any.whl

Download URL slack_timezoner-0.1.3-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d83d9f50d9ea1f9f7b6ce1af3a0ba6935e374ec943c9d2a545d32c94e2fa9daf
BLAKE2b-256 checksum
How to use checksums
2278ede1adbdec04be2abd3b50d76a61039f418fdfa1cc76ca82dcc983cf3776
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.9 CPython/3.6.10 Darwin/19.6.0

Security for slack-timezoner 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page