Skip to main content

A toy app to give a breakdown of timezone distribution in a slack workgroup

Project description

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. It prints out 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_timezonr.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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slack-timezoner-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slack_timezoner-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file slack-timezoner-0.1.1.tar.gz.

File metadata

  • Download URL: slack-timezoner-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.6.10 Darwin/19.6.0

File hashes

Hashes for slack-timezoner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e6eebfb43881c6750e67dd46dc63a16db3afa18926bc717b048eee7c727b5b93
MD5 7bcb7b5a12e2f1e9cffe98a7a8693afe
BLAKE2b-256 446ee0822dba8a813bc5c4272e38aff362fe7ba0850ffdc5ae3683f35cfec266

See more details on using hashes here.

File details

Details for the file slack_timezoner-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: slack_timezoner-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.6.10 Darwin/19.6.0

File hashes

Hashes for slack_timezoner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67e95ded8ee019df5f4620cd424ac1fcd9fde2587b04c0d909a7f65a68bd852b
MD5 efb365dc723754dbc173b48d2dad23d5
BLAKE2b-256 bdc07473bc9b798c97e4605768b431a5316f52a81094ebcc5999cca97bb674b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page