Slackybot
This Python package helps you with sending messages to Slack. It offers an object-oriented approach - every message or reply in a thread is an object, so they can be easily managed.
Getting started
Installation
python -m pip install slackybot
Add following token scopes to your Slack bot:
channels:join channels:read chat:write chat:write.customize chat:write.public
Simple usage
Import and initialize the slack object
from slackybot import Slack
slack = Slack(token='XXX')
As a best practice, it is better to pass the token using an environment variable (e.g. .env file)
To send a message you have to use the Slack object method. It takes two arguments: channel and text they are both strings.
slack.send_message(channel='channel-name', text='Sample text')
The above method returns the Message object.
To update a message you may use the Message method .update(). It takes one argument: text as a string.
message = slack.send_message(channel='', text='')
message.update(text='New text')
To send a reply in the message thread simply use .send_reply() method. It takes one argument: text as a string.
message = slack.send_message(channel='', text='')
message.send_reply(text='Reply message in the thread')
The above method returns the Reply object.
Both objects Message and Reply can be deleted by using .delete() method on them. Those objects can be listed using:
.get_messages()on the Slack object.get_replies()on the Message object
Metadata
Release files for slackybot 1.2.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 | |
|---|---|---|---|
| slackybot-1.2.0.tar.gz | 7.3 kB | Details |
Release files / slackybot-1.2.0.tar.gz
| Download URL | slackybot-1.2.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9949b6f1fd0e3128babd244611a3a304db6b78dd79360cf0f5cefc741fb352d6
|
|
BLAKE2b-256 checksum How to use checksums |
d1128dfb3baeb55247d5c29cb317276e8b66e7b833ddead9df97ea9f1b262fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|