slack.slack#

Slacker is a lightweight wrapper used to send messages using SlackClient, Slack’s python API library.

Slack Token#

You will have to create a new Slack App and install it to your workspace. This should generate the OAuth token needed by Bookmarks.

Scopes#

The Slack App requires the users:read and chat:write scopes to function. To send messages to Slack Channels the bot is not part of add chat:write.public. Scopes channels:read and groups:read are needed to list the available Slack channels.

See http://api.slack.com/apps for more information.

Classes:

OverlayWidget([parent])

SlackClient(token)

Customized SlackClient used by bookmarks to send and receive messages.

SlackWidget(token[, parent])

UsersModel(token[, parent])

Model used to store the available profiles.

UsersWidget(token[, parent])

class bookmarks.slack.slack.OverlayWidget(parent=None)[source]#

Bases: QWidget

Methods:

paintEvent(self, event)

showEvent(event)

Show event handler.

paintEvent(self, event: PySide2.QtGui.QPaintEvent) None[source]#
showEvent(event)[source]#

Show event handler.

class bookmarks.slack.slack.SlackClient(token)[source]#

Bases: WebClient

Customized SlackClient used by bookmarks to send and receive messages.

Methods:

get_channels()

Returns all conversations and groups.

get_user_profiles()

Returns all available profiles in the workspace associated with the token.

send_message(channel, text)

Send a message using SlackClient.

verify_token()

Tests the slack token and the permissions needed to send messages to channels.

get_channels()[source]#

Returns all conversations and groups.

get_user_profiles()[source]#

Returns all available profiles in the workspace associated with the token. Make sure scope users.read is available for the token.

Raises:

ValueError – If the token is invalid or missing a required scope.

send_message(channel, text)[source]#

Send a message using SlackClient.

verify_token()[source]#

Tests the slack token and the permissions needed to send messages to channels.

Using the Conversations API,the app requires any channels:read and/or groups:read to get channel lists.

Addittionally, chat.write and users.read are required to send messages.

Raises:

ValueError – When the any problems with the token.

class bookmarks.slack.slack.SlackWidget(token, parent=None)[source]#

Bases: QDialog

Methods:

send_message()

Sends a message using the SlackClient API.

showEvent(event)

Show event handler.

send_message()[source]#

Sends a message using the SlackClient API.

showEvent(event)[source]#

Show event handler.

class bookmarks.slack.slack.UsersModel(token, parent=None)[source]#

Bases: QAbstractItemModel

Model used to store the available profiles.

Methods:

columnCount(self[, parent])

data(self, index[, role])

get_icon(index)

Downloads and sets the icon for the given index.

get_pretty_name(member)

Returns a pretty name for the given member.

index(row, column[, parent])

Bog-standard index creator.

init_data()

Initializes data.

parent(-> PySide2.QtCore.QObject)

rowCount(self[, parent])

setData(self, index, value[, role])

columnCount(self, parent: PySide2.QtCore.QModelIndex = Invalid(PySide2.QtCore.QModelIndex)) int[source]#
data(self, index: PySide2.QtCore.QModelIndex, role: int = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any[source]#
get_icon(index)[source]#

Downloads and sets the icon for the given index.

get_pretty_name(member)[source]#

Returns a pretty name for the given member.

index(row, column, parent=QtCore.QModelIndex())[source]#

Bog-standard index creator.

init_data()[source]#

Initializes data.

parent(self) PySide2.QtCore.QObject[source]#
parent(self, child: PySide2.QtCore.QModelIndex) PySide2.QtCore.QModelIndex
rowCount(self, parent: PySide2.QtCore.QModelIndex = Invalid(PySide2.QtCore.QModelIndex)) int[source]#
setData(self, index: PySide2.QtCore.QModelIndex, value: Any, role: int = PySide2.QtCore.Qt.ItemDataRole.EditRole) bool[source]#
class bookmarks.slack.slack.UsersWidget(token, parent=None)[source]#

Bases: QListView