Slack read-only bot
Manage your Slack community by making read-only channels. Only admins can post to read-only channels, other users' messages get deleted and the user gets a message from the bot.
Setup
Create the Bot
- Create a new classic Slack app for your workspace at https://api.slack.com/apps?new_classic_app=1 .
- Click App Home, click the Add Legacy Bot User button, and give your bot a username and name.
- Click OAuth & Permissions . Under Scopes click Add an OAuth Scope and add the following
scopes:
bot- Allow users to interact with the bot (needed to message users)chat:write:bot- Allow deleting user messages
- On the same page click on the Install App to Workspace button and authorize it to connect to your workspace. Note that the account that authorizes the bot must be able to delete the messages of other users. This is usually just the workspace owner/admin.
- Back on the OAuth & Permissions page, copy the two access tokens (one should start with
xoxp-and the other withxoxb-). - Invite the bot to all the channels you want to make read-only.
Run the bot
- Install the bot using
pip(pip install git+https://github.com/pR0Ps/slack-read-only-bot) - Create a config file based on the following example:
app_token: xoxp-...
bot_token: xoxb-...
delete_msg: The channel you just posted to is read-only, only admins can post to it.
admins:
- admin1
- admin2
channels:
- channel1
- channel2
- Run
slack-read-only-bot --config <path to file>to run the bot and test that it works as expected. - [optional] Configure your system to run
slack-read-only-botas a service using something likesystemdto ensure that it runs at startup, restarts if it crashes, etc. See slack-read-only-bot.service for an example/template.
Credits
Release files for slack-read-only-bot 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| slack-read-only-bot-1.0.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slack_read_only_bot-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / slack-read-only-bot-1.0.0.tar.gz
| Download URL | slack-read-only-bot-1.0.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fe99997329bd2c46243716e641232f1b3165fe4702923192812a0864c5a6ed7
|
|
BLAKE2b-256 checksum How to use checksums |
ae7110c4a6d655f559c9c4e9ade3229a24770f9ac0d6bb040e9d4a0081c04b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Release files / slack_read_only_bot-1.0.0-py3-none-any.whl
| Download URL | slack_read_only_bot-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
580e36acfc4edde1e176a48c4aef962b71a2256adbb283b7861a525b2d185cfd
|
|
BLAKE2b-256 checksum How to use checksums |
5ffaccc862567cbae241114bfed025997f697a1c48afa39965edaef59b149dda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|