slackest package¶
Submodules¶
slackest.api module¶
-
class
slackest.api.API(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Test API. See https://api.slack.com/methods
slackest.apps module¶
-
class
slackest.apps.Apps(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Apps API. See https://api.slack.com/methods
-
permissions¶
-
slackest.apps_permissions module¶
-
class
slackest.apps_permissions.AppsPermissions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack AppsPermissions API. See https://api.slack.com/methods
slackest.auth module¶
-
class
slackest.auth.Auth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Auth API. See https://api.slack.com/methods
slackest.base_api module¶
-
class
slackest.base_api.BaseAPI(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
objectBaseAPI interface for making the requests calls to Slack.
slackest.bots module¶
-
class
slackest.bots.Bots(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Bots API. See https://api.slack.com/methods
slackest.channels module¶
-
class
slackest.channels.Channels(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Channels API. See https://api.slack.com/methods
-
archive(channel)[source]¶ Archives a public channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name)[source]¶ Creates a public channel
- Parameters
name (str) – The name
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channel_id(channel_name)[source]¶ Gets a channel ID according to the channel’s name
- Parameters
channel_name (str) – The channel’s name
- Returns
Returns the channel ID
- Return type
str
-
history(channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False)[source]¶ Fetches history of messages and events from a channel
- Parameters
channel (str) – The channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
count (int) – The number of messages to return
inclusive (bool) – Include messages with latest or oldest timestamp in results
unreads (bool) – Include unread_count_display in the output
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel)[source]¶ Retrieves information about a public channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, user)[source]¶ Invites a user to a private channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
join(name)[source]¶ Allows a user object to join a channel
- Parameters
name (str) – The channel name (#general)
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to leave a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(exclude_archived=True, exclude_members=False)[source]¶ Lists channels
- Parameters
exclude_archived (bool) – Exclude archived channels
exclude_members (bool) – Exclude members from being listed
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Moves the read cursor in a public channel
- Parameters
channel (str) – The channel ID
time_stamp (str) – The timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a channel
- Parameters
channel (str) – The channel ID
name (str) – The new user-friendly name of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, thread_ts)[source]¶ Retrieve a thread of messages posted to a channel
- Parameters
channel (str) – The channel ID
thread_ts (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose of a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The purpose
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.chat module¶
-
class
slackest.chat.Chat(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Chat API. See https://api.slack.com/methods
-
command(channel, command, text)[source]¶ DEPRECATED? Run a command in a chat
- Parameters
channel (str) – The channel ID
command (str) – The command to run
text (str) – The text attached to the command
- Returns
A response object to run the API request.
- Return type
Responseobject
-
delete(channel, time_stamp, as_user=False)[source]¶ Delete a message
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to be deleted
as_user (bool) – Deletes the message as the authed user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_permalink(channel, message_ts)[source]¶ Retrieve a permalink URL for a specific extant message
- Parameters
channel –
message_ts –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
me_message(channel, text)[source]¶ Share a me message to a channel
- Parameters
channel (str) – The channel to post to
text (str) – The text of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_ephemeral(channel, text, user, as_user=False, attachments=None, link_names=True, parse=None)[source]¶ Sends an ephemeral message to a user in a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to send
user (str) – The user ID
as_user (bool) – Posts the message as the authed user
attachments (JSON) – JSON array of structured attachments
link_names (str) – Link channel names and users
parse (str) – Change how messages are treated
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message(channel, text=None, username=None, as_user=False, parse=None, link_names=None, attachments=None, unfurl_links=None, unfurl_media=None, icon_url=None, icon_emoji=None, thread_ts=None, reply_broadcast=False)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to post
username (str) – The username to post as, must be used w/ as_user
as_user (bool) – Posts as the user instead of a bot
parse (str) – Change how messages are treated
link_names (str) – Find and link channel names and username
attachments (JSON) – JSON based array of structured attachments
unfurl_links (str) – Enable unfurling of links
unfurl_media (str) – Enable unfurling of media
icon_url (str) – The icon URL
icon_emoji (str) – Emoji to use as the icon for this message
thread_ts (str) – Provide another messages ts value to make this message a reply
reply_broadcast (bool) – Indicates whether reply should be visible in the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message_basic(channel, text=None, link_names=None)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to post
link_names (str) – Find and link channel names and username
- Returns
A response object to run the API request.
- Return type
Responseobject
-
unfurl(channel, time_stamp, unfurls, user_auth_message=None, user_auth_required=False, user_auth_url=None)[source]¶ Provides custom unfurl behavior for user posted URLS
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to add unfurl behavior
unfurls (JSON) – JSON map with keys set to URLS in the message
user_auth_message (str) – Invitation to user to use Slack app
user_auth_required (bool) – Slack app required
user_auth_unfurl (str) – URL for completion
- Returns
A response object to run the API request.
- Return type
Responseobject
-
update(channel, time_stamp, text, attachments=None, parse=None, link_names=None, as_user=False)[source]¶ Updates a message in a channel
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to be updated
text (str) – New text for the message
attachments (JSON) – JSON array of structured attachments
parse (str) – Change hor messages are treated
link_names (str) – Find and link channel names
as_user (bool) – Update the message as the authed user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.constants module¶
slackest.conversation module¶
-
class
slackest.conversation.Conversation(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Conversation API. See https://api.slack.com/docs/conversations-api#methods
-
archive(channel)[source]¶ Archives a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
close(channel)[source]¶ Closes a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name, is_private=True, users=[])[source]¶ Creates a channel
- Parameters
name (str) – The channel name
is_private (bool) – Determines if channel is private (like a group)
users (list[str]) – A list of User IDs to add to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, cursor=None, inclusive=False, limit=100, latest=1618861110.40856, oldest=0)[source]¶ Fetches history of messages and events from a channel
- Parameters
channel (str) – The channel ID
cursor (str) – the cursor id of the next set of history
inclusive (bool) – Include messages with latest or oldest timestamp in results
limit (int) – The number of messages to return
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history_all(channel)[source]¶ Fetches all history of messages and events from a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel, include_locale=False, include_num_members=False)[source]¶ Gets information about a channel.
- Parameters
channel (str) – The channel ID
include_locale (bool) – Include the locale of the members in the channel
include_num_members (bool) – Include the number of members in the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, users=[])[source]¶ Invites users to a channel
- Parameters
name (str) – The channel ID
users (list[str]) – A list of User IDs to invite to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
join(channel)[source]¶ Allows a user object to join a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to leave a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(cursor=None, exclude_archived=False, limit=100, types='public_channel')[source]¶ Lists channels
- Parameters
cursor (str) – the cursor id of the next set of the list
exclude_archived (bool) – Exclude archived channels
limit (int) – The number of conversations to return
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all(exclude_archived=False, types='public_channel')[source]¶ Lists all channels
- Parameters
exclude_archived (bool) – Exclude archived channels
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
members(channel, cursor=None, limit=100)[source]¶ Lists members of a channel
- Parameters
channel (str) – The channel ID
cursor (str) – the cursor id of the next set of the list
limit (int) – The number of messages to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
members_all(channel)[source]¶ Lists all members of a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
now= time.struct_time(tm_year=2021, tm_mon=4, tm_mday=19, tm_hour=19, tm_min=38, tm_sec=30, tm_wday=0, tm_yday=109, tm_isdst=-1)¶
-
open(channel, return_im=True, users=[])[source]¶ Opens or resumes DMs or multi person DMs
- Parameters
channel (str) – The channel ID
return_im (bool) – Indicates you wnat the full IM channel definition in the response
user_ids (list[str]) – A list of User IDs to invite to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a channel
- Parameters
channel (str) – The channel ID to rename
name (str) – The new name of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, time_stamp, cursor=None, inclusive=False, limit=100, latest=1618861110.40856, oldest=0)[source]¶ Fetches replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
cursor (str) – the cursor id of the next set of replies
inclusive (bool) – Include messages with latest or oldest timestamp in results
limit (int) – The number of messages to return
latest (str) – End of time range to include in results
latest – Start of time range to include in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies_all(channel, time_stamp)[source]¶ Fetches all replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
setPurpose(channel, purpose)[source]¶ Assigns purpose to a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The new purpose of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
setTopic(channel, topic)[source]¶ Assigns topic to a channel
- Parameters
channel (str) – The channel ID
topic (str) – The new topic of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
timestamp= 1618861110.40856¶
-
slackest.dialog module¶
-
class
slackest.dialog.Dialog(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Dialog API. See https://api.slack.com/methods
slackest.dnd module¶
-
class
slackest.dnd.DND(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack DND API. See https://api.slack.com/methods
-
end_dnd()[source]¶ Ends the current user’s DND session
- Returns
A response object to run the request.
- Return type
Responseobject
-
end_snooze()[source]¶ End’s the current user’s snooze
- Returns
A response object to run the request.
- Return type
Responseobject
-
info(user=None)[source]¶ Retrieves the current user’s DND status
- Parameters
user (str) – User ID to fetch status
- Returns
A response object to run the request.
- Return type
Responseobject
-
slackest.emoji module¶
-
class
slackest.emoji.Emoji(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Emoji API. See https://api.slack.com/methods
slackest.files module¶
-
class
slackest.files.Files(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Files API. See https://api.slack.com/methods
-
comments¶
-
delete(file_)[source]¶ Deletes a file
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(file_, count=None, page=None, cursor=None, limit=100)[source]¶ Gents information about a file
- Parameters
file (str) – The file ID
count (int) – Number of items to return
page (int) – Page number of results to return
cursor (str) – The parameter for pagination
limit (int) – Max number of items to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, ts_from=None, ts_to=None, types=None, count=None, page=None, channel=None)[source]¶ List of files within a team
- Parameters
user (str) – Filter files to this user ID
ts_from (str) – Timestamp from = after
ts_to (str) – Timestamp to = before
types (str) – Filter files by type
count (int) – Number of items to return
page (int) – Page number of results to return
channel (str) – Filter files to this channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
revoke_public_url(file_)[source]¶ Revokes public sharing
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
Enables public sharing
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
upload(file_=None, content=None, filetype=None, filename=None, title=None, initial_comment=None, channels=None, thread_ts=None)[source]¶ Uploads or creates a file
- Parameters
file (str) – The file ID
content (binary) – File contents via a POST variable
filetype (str) – File type identifier
filename (str) – File name
title (str) – Title of the file
initial_comment (str) – Comment on the file
channels (list[str]) – CSV of channel names to post to
thread_ts (str) – Parent thread to use in a reply
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.files_comments module¶
-
class
slackest.files_comments.FilesComments(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack FilesComments API. See https://api.slack.com/methods
-
add(file_, comment)[source]¶ DEPRECATED - Adds a comment to a file
- Parameters
file (str) – The file ID
comment (str) – Text of the comment
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.groups module¶
-
class
slackest.groups.Groups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Groups API. See https://api.slack.com/methods
-
archive(channel)[source]¶ Archives a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
close(channel)[source]¶ Closes a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name)[source]¶ Creates a group with the name
- Parameters
name (str) – The group’s name
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create_child(channel)[source]¶ Takes an existing private channel and performs the following steps:
Renames the existing private channel (from “example” to “example-archived”).
Archives the existing private channel.
Creates a new private channel with the name of the existing private channel.
Adds all members of the existing private channel to the new private channel.
- Parameters
channel (str) – Private channel to clone and archive
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, count=None, inclusive=True)[source]¶ Fetches history of messages and events from a private channel
- Parameters
channel (str) – The private channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
count (int) – The number of messages to return
inclusive (bool) – Include messages with latest or oldest timestamp in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel)[source]¶ Returns the private channel’s information
- Parameters
channel (str) – The private channel’s ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, user)[source]¶ Invites a user to a private channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a private channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to remove themselves from a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(exclude_archived=True, exclude_members=False)[source]¶ Lists the private channels that the user has access to
- Parameters
exclude_archived (bool) – Don’t include archived private channels in the returned list
exclude_members (bool) – Don’t include members in the returned list
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Moves the read cursor in a private channel
- Parameters
channel (str) – The private channel ID
time_stamp (str) – The timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
open(channel)[source]¶ Opens a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a private channel
- Parameters
channel (str) – The private channel ID
name (str) – The new user-friendly name of the private channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, thread_ts)[source]¶ Retrieve a thread of messages posted to a private channel
- Parameters
channel (str) – The private channel ID
thread_ts (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose of a private channel
- Parameters
channel (str) – The private channel ID
purpose (str) – The purpose
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.idp_groups module¶
-
class
slackest.idp_groups.IDPGroups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack IDPGroups API. See https://api.slack.com/methods
slackest.im module¶
-
class
slackest.im.IM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack IM API. See https://api.slack.com/methods
-
close(channel)[source]¶ Close a DM channel
- Parameters
channel –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, count=None, inclusive=True, unreads=False)[source]¶ Fetches history of messages and events from a DM channel
- Parameters
channel (str) – The channel ID
latest (str) – End of time range of messages to include in results
oldest (str) – Start of time range of messages to include in results
count (int) – Number of messages to return
inclusive (bool) – Include messages with oldest/latest inclusive
unreads (bool) – Include unread count display
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list()[source]¶ Lists direct messages for the calling user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Sets the read cursor in a DM
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
open(user, include_locale=True, return_im=True)[source]¶ Opens a DM channel
- Parameters
user (str) – User to open a DM channel with
include_locale (str) – Receive locales for this DM
return_im (True) – Return the full IM channel definition
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.incoming_webhook module¶
-
class
slackest.incoming_webhook.IncomingWebhook(url=None, timeout=10, proxies=None)[source]¶ Bases:
objectFollows the Slack IncomingWebhook API. See https://api.slack.com/methods
-
post(data)[source]¶ Posts message with payload formatted in accordance with this documentation https://api.slack.com/incoming-webhooks
- Parameters
data (A JSON representation of the payload) – The data payload
- Returns
A response object to run the request.
- Return type
Responseobject
-
slackest.mpim module¶
-
class
slackest.mpim.MPIM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack MPIM API. See https://api.slack.com/methods
-
close(channel)[source]¶ Closes a MPIM
- Parameters
channel (str) – the channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, inclusive=False, count=None, unreads=False)[source]¶ Fetches a history of messages and events
- Parameters
channel (str) – The channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
inclusive (str) – Include latest/oldest messags
count (int) – Number of messages to return
unreads (str) – Include count display
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list()[source]¶ Lists MPIM for the calling user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Sets the read cursor in a MPIM
- Parameters
channel (str) – The channel ID
time_stamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.oauth module¶
-
class
slackest.oauth.OAuth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack OAuth API. See https://api.slack.com/methods
-
access(client_id, client_secret, code, redirect_uri=None)[source]¶ Exchanges a temporary OAuth verifier code for an access token
- Parameters
client_id (str) – Issued when you created your application
client_secret (str) – Issued when you created your application.
code (str) – Code para returned via the callback
redirect_uri (str) – URL to land on
- Returns
A response object to run the API request.
- Return type
Responseobject
-
token(client_id, client_secret, code, redirect_uri=None, single_channel=None)[source]¶ Exchanges a temporary OAuth verifier code for a workspace token
- Parameters
client_id (str) – Issued when you created your application
client_secret (str) – Issued when you created your application.
code (str) – Code para returned via the callback
redirect_uri (str) – URL to land on
single_channel (str) – Request the user to add the app only to a single channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.pins module¶
-
class
slackest.pins.Pins(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Pins API. See https://api.slack.com/methods
-
add(channel, file_=None, file_comment=None, timestamp=None)[source]¶ Pins an item to a channel
- Parameters
channel (str) – The channel ID
file (str) – The File ID to add
file_comment (str) – The file comment ID to add
timestamp (str) – Timestamp of the message to add
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(channel)[source]¶ Lists items pinned to a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
remove(channel, file_=None, file_comment=None, timestamp=None)[source]¶ Un-pins an item from a channel
- Parameters
channel (str) – The channel ID
file (str) – The File ID to remove
file_comment (str) – The file comment ID to remove
timestamp (str) – Timestamp of the message to remove
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.presence module¶
-
class
slackest.presence.Presence(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Presence API. See https://api.slack.com/methods
-
ACTIVE= 'active'¶
-
AWAY= 'away'¶
-
TYPES= ('away', 'active')¶
-
slackest.reactions module¶
-
class
slackest.reactions.Reactions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Reactions API. See https://api.slack.com/methods
-
add(name, file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Adds a reaction to an item
- Parameters
name (str) – Reaction name
file (str) – File to add reaction to
file_comment (str) – File comment to add reaction to
channel (str) – Channel where the message to add reaction
timestamp (str) – Timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get(file_=None, file_comment=None, channel=None, timestamp=None, full=None)[source]¶ Gets reactions for an item
- Parameters
file (str) – File to get reaction
file_comment (str) – File comment to get reaction
channel (str) – Channel where the message to get reaction
timestamp (str) – Timestamp of the message
full (str) – Return complete reaction list
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, full=None, count=None, page=None)[source]¶ List reactions made by a user
- Parameters
user (str) – User ID to list reactions
full (str) – Return complete reaction list
count (int) – Number of items to return on the page
page (int) – Page number of results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
remove(name, file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Removes a reaction from an item
- Parameters
name (str) – Reaction name
file (str) – File to remove reaction
file_comment (str) – File comment to remove reaction
channel (str) – Channel where the message to remove reaction
timestamp (str) – Timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.reminders module¶
-
class
slackest.reminders.Reminders(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Reminders API. See https://api.slack.com/methods
-
add(text, reminder_time, user=None)[source]¶ Creates a reminder
- Parameters
text (str) – Content of the reminder
reminder_time (int) – Unix timestamp to show the reminder
user (str) – User ID attached to the reminder
- Returns
A response object to run the request.
- Return type
Responseobject
-
complete(reminder)[source]¶ Mark the reminder as completed
- Parameters
reminder (str) – The reminder ID
- Returns
A response object to run the request.
- Return type
Responseobject
-
delete(reminder)[source]¶ Deletes a reminder
- Parameters
reminder (str) – The reminder ID
- Returns
A response object to run the request.
- Return type
Responseobject
-
slackest.response module¶
slackest.rtm module¶
-
class
slackest.rtm.RTM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack RTM API. See https://api.slack.com/methods
-
connect()[source]¶ Start a Real Time Messaging session
- Returns
A response object to run the API request.
- Return type
Responseobject
-
start(simple_latest=True, no_unreads=False, mpim_aware=False)[source]¶ Start a Real Time Messaging session
- Parameters
simple_latest (bool) – Return timestamp only for latest message object
no_unreads (bool) – Skip unread counts
mpim_aware (bool) – Returns MPIMs to the client
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.search module¶
-
class
slackest.search.Search(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Search API. See https://api.slack.com/methods
-
all(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for messages and files matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
files(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for files matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
messages(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for messages matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.slackest module¶
-
class
slackest.slackest.Slackest(token, incoming_webhook_url=None, timeout=10, http_proxy=None, https_proxy=None, session=None, rate_limit_retries=0)[source]¶ Bases:
objectThe main Slackest work horse. Surfaces some convenience methods but mostly interfaces with the auxilary classes.
-
add_member_to_channel(channel, member)[source]¶ Invites a user to a channel
- Parameters
channel (str) – The channel ID
user (str) – A user ID to invite to a channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create_channel(name, is_private=True, users=[])[source]¶ Creates a channel
- Parameters
name (str) – The channel name
is_private (bool) – Determines if channel is private (like a group)
user_ids (list[str]) – A list of User IDs to add to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channel_info(channel)[source]¶ Gets information about a channel.
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channels(exclude_archive, types)[source]¶ Lists all channels
- Parameters
exclude_archived (bool) – Exclude archived channels
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_replies(channel, time_stamp)[source]¶ Fetches all replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history_all(channel)[source]¶ Fetches all history of messages and events from a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick_user(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all_users()[source]¶ Lists all users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
oauth= <slackest.oauth.OAuth object>¶
-
post_message_to_channel(channel, message)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
message (str) – The message text
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message_to_channel_basic(channel, message)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
message (str) – The message text
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_thread_to_message(channel, message, thread_ts)[source]¶ - Parameters
channel (str) – The channel ID
message (str) – The message text
thread_ts (str) – The parent thread timestamp identifier
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The purpose to set
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.slackest_error module¶
slackest.stars module¶
-
class
slackest.stars.Stars(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Stars API. See https://api.slack.com/methods
-
add(file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Adds a star to an item
- Parameters
file (str) – The file ID
file_comment (str) – The comment on the file
channel (str) – The channel ID
timestamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, count=None, page=None)[source]¶ Lists stars for a user
:param : :type : :return: A response object to run the API request. :rtype:
Responseobject
-
remove(file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Removes a star from an item
- Parameters
file (str) – The file ID
file_comment (str) – The comment on the file
channel (str) – The channel ID
timestamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.team module¶
-
class
slackest.team.Team(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Team API. See https://api.slack.com/methods
-
access_logs(count=None, page=None, before=None)[source]¶ Gets the access log for the current team
- Parameters
count (int) – Number of items to return in the page
page (int) – The page number of results
before (int) – End time range of logs to include
- Returns
A response object to run the API request.
- Return type
Responseobject
-
billable_info(user=None)[source]¶ Gets billable users information
- Parameters
user –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info()[source]¶ Gets information about the current team
- Returns
A response object to run the API request.
- Return type
Responseobject
-
integration_logs(service_id=None, app_id=None, user=None, change_type=None, count=None, page=None)[source]¶ Gets the integration logs for the current team
- Parameters
service_id (str) – Filter logs to this service
app_id (str) – Filter logs to this slack app
user (str) – Filter logs generated by this user
change_type (str) – Filter logs to this change type
count (int) – Number of items to return per page
page (int) – The page number of results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
profile¶
-
slackest.team_profile module¶
-
class
slackest.team_profile.TeamProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack TeamProfile API. See https://api.slack.com/methods
slackest.user_group_users module¶
-
class
slackest.user_group_users.UserGroupsUsers(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UserGroupUsers API. See https://api.slack.com/methods
-
list(usergroup, include_disabled=False)[source]¶ Lists all users in a usergroup
- Parameters
usergroup (str) – The usergroup ID
include_disabled (bool) – Include disabled users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
update(usergroup, users, include_count=False)[source]¶ Updates the list of users for a usergroup
- Parameters
usergroup (str) – The usergroup ID
users (list[str]) – CSV of user IDs to add
include_count (bool) – Include a count of users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.user_groups module¶
-
class
slackest.user_groups.UserGroups(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UserGroups API. See https://api.slack.com/methods
-
create(name, handle=None, description=None, channels=None, include_count=False)[source]¶ Creates a new usergroup
- Parameters
name (str) – A name for the usergroup
handle (str) – The mention handle
description (str) – Description of the usergroup
channels (list[str]) – CSV of channel IDs for the usergroup
include_count (bool) – Include the number of users in the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
disable(usergroup, include_count=True)[source]¶ Disable a UserGroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
include_count (bool) – Include the number of users
- Returns
A response object to run the request.
- Return type
Responseobject
-
enable(usergroup, include_count=True)[source]¶ Enable a UserGroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
include_count (bool) – Include the number of users
- Returns
A response object to run the request.
- Return type
Responseobject
-
list(include_disabled=False, include_count=False, include_users=False)[source]¶ Lists all of the usergroups
- Parameters
include_disabled (bool) – Include disabled usergroups
include_count (bool) – Include the number of users in the usergroup
include_users (bool) – Include the list of users of the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
update(usergroup, name=None, handle=None, description=None, channels=None, include_count=True)[source]¶ Update an existing usergroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
name (str) – A name for the usergroup
handle (str) – The mention handle
description (str) – Description of the usergroup
channels (list[str]) – CSV of channel IDs for the usergroup
include_count (bool) – Include the number of users in the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
users¶
-
slackest.users module¶
-
class
slackest.users.Users(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Users API. See https://api.slack.com/methods
-
admin¶
-
get_presence(user)[source]¶ Gets the presence of the Slack user
- Parameters
user (str) – The Slack user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_user_id(user_name)[source]¶ Gets a user ID according to the user’s name
- Parameters
user_name (str) – The user’s name
- Returns
Returns the user ID
- Return type
str
-
identity()[source]¶ Retrieves the user’s identity: name, ID, team
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(user, include_locale=False)[source]¶ Returns information about the user
- Parameters
user (str) – The Slack user ID of the user to look up
include_locale (bool) – Whether or not to include the user’s locale
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(cursor=None, include_locale=True, limit=500)[source]¶ List all users in a Slack team.
- Parameters
cursor (str) – Cursor pagination
include_locale (bool) – Receive the user’s locale
limit (int) – The maximum number of users to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all(include_locale=True)[source]¶ Lists all users in a Slack team
- Parameters
include_locale (bool) – Receive the user’s locale
- Returns
A response object to run the API request.
- Return type
Responseobject
-
profile¶ Returns the profile object attribute
- Returns
A usersprofile object.
- Return type
UsersProfileobject
-
slackest.users_admin module¶
-
class
slackest.users_admin.UsersAdmin(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UsersAdmin API. See https://api.slack.com/methods
-
invite(email, channels=None, first_name=None, last_name=None, resend=True)[source]¶ DEPRECATED - Invites a user to channel(s) via email. Looks to be deprecated.
- Parameters
email (str) – Email of the user to invite to a channel(s)
channels (str) – A CSV of channels for the invite.
first_name (str) – First name of the invitee
last_name (str) – Last name of the invitee
resend (bool) – Whether or not this invite is a resend
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.users_profile module¶
-
class
slackest.users_profile.UsersProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UsersProfile API. See https://api.slack.com/methods
-
get(user=None, include_labels=False)[source]¶ Gets a Slack user’s profile
- Parameters
user (str) – User to retrieve profile info for
include_labels (bool) – Include labels for each ID in custom profile fields
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set(user=None, profile=None, name=None, value=None)[source]¶ Gets a Slack user’s profile
- Parameters
user (str) – ID of user to change
profile (str) – Collection of key:value pairs presented as a URL-encoded JSON hash
name (str) – Name of a single key to set
value (str) – Value to set a single key to
- Returns
A response object to run the API request.
- Return type
Responseobject
-
slackest.utils module¶
Module contents¶
-
class
slackest.BaseAPI(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
objectBaseAPI interface for making the requests calls to Slack.
-
class
slackest.API(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Test API. See https://api.slack.com/methods
-
class
slackest.Auth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Auth API. See https://api.slack.com/methods
-
class
slackest.Users(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Users API. See https://api.slack.com/methods
-
admin¶
-
get_presence(user)[source]¶ Gets the presence of the Slack user
- Parameters
user (str) – The Slack user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_user_id(user_name)[source]¶ Gets a user ID according to the user’s name
- Parameters
user_name (str) – The user’s name
- Returns
Returns the user ID
- Return type
str
-
identity()[source]¶ Retrieves the user’s identity: name, ID, team
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(user, include_locale=False)[source]¶ Returns information about the user
- Parameters
user (str) – The Slack user ID of the user to look up
include_locale (bool) – Whether or not to include the user’s locale
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(cursor=None, include_locale=True, limit=500)[source]¶ List all users in a Slack team.
- Parameters
cursor (str) – Cursor pagination
include_locale (bool) – Receive the user’s locale
limit (int) – The maximum number of users to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all(include_locale=True)[source]¶ Lists all users in a Slack team
- Parameters
include_locale (bool) – Receive the user’s locale
- Returns
A response object to run the API request.
- Return type
Responseobject
-
profile¶ Returns the profile object attribute
- Returns
A usersprofile object.
- Return type
UsersProfileobject
-
-
class
slackest.Groups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Groups API. See https://api.slack.com/methods
-
archive(channel)[source]¶ Archives a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
close(channel)[source]¶ Closes a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name)[source]¶ Creates a group with the name
- Parameters
name (str) – The group’s name
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create_child(channel)[source]¶ Takes an existing private channel and performs the following steps:
Renames the existing private channel (from “example” to “example-archived”).
Archives the existing private channel.
Creates a new private channel with the name of the existing private channel.
Adds all members of the existing private channel to the new private channel.
- Parameters
channel (str) – Private channel to clone and archive
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, count=None, inclusive=True)[source]¶ Fetches history of messages and events from a private channel
- Parameters
channel (str) – The private channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
count (int) – The number of messages to return
inclusive (bool) – Include messages with latest or oldest timestamp in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel)[source]¶ Returns the private channel’s information
- Parameters
channel (str) – The private channel’s ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, user)[source]¶ Invites a user to a private channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a private channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to remove themselves from a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(exclude_archived=True, exclude_members=False)[source]¶ Lists the private channels that the user has access to
- Parameters
exclude_archived (bool) – Don’t include archived private channels in the returned list
exclude_members (bool) – Don’t include members in the returned list
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Moves the read cursor in a private channel
- Parameters
channel (str) – The private channel ID
time_stamp (str) – The timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
open(channel)[source]¶ Opens a private channel
- Parameters
channel (str) – The private channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a private channel
- Parameters
channel (str) – The private channel ID
name (str) – The new user-friendly name of the private channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, thread_ts)[source]¶ Retrieve a thread of messages posted to a private channel
- Parameters
channel (str) – The private channel ID
thread_ts (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose of a private channel
- Parameters
channel (str) – The private channel ID
purpose (str) – The purpose
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Conversation(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Conversation API. See https://api.slack.com/docs/conversations-api#methods
-
archive(channel)[source]¶ Archives a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
close(channel)[source]¶ Closes a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name, is_private=True, users=[])[source]¶ Creates a channel
- Parameters
name (str) – The channel name
is_private (bool) – Determines if channel is private (like a group)
users (list[str]) – A list of User IDs to add to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, cursor=None, inclusive=False, limit=100, latest=1618861110.40856, oldest=0)[source]¶ Fetches history of messages and events from a channel
- Parameters
channel (str) – The channel ID
cursor (str) – the cursor id of the next set of history
inclusive (bool) – Include messages with latest or oldest timestamp in results
limit (int) – The number of messages to return
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history_all(channel)[source]¶ Fetches all history of messages and events from a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel, include_locale=False, include_num_members=False)[source]¶ Gets information about a channel.
- Parameters
channel (str) – The channel ID
include_locale (bool) – Include the locale of the members in the channel
include_num_members (bool) – Include the number of members in the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, users=[])[source]¶ Invites users to a channel
- Parameters
name (str) – The channel ID
users (list[str]) – A list of User IDs to invite to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
join(channel)[source]¶ Allows a user object to join a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to leave a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(cursor=None, exclude_archived=False, limit=100, types='public_channel')[source]¶ Lists channels
- Parameters
cursor (str) – the cursor id of the next set of the list
exclude_archived (bool) – Exclude archived channels
limit (int) – The number of conversations to return
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all(exclude_archived=False, types='public_channel')[source]¶ Lists all channels
- Parameters
exclude_archived (bool) – Exclude archived channels
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
members(channel, cursor=None, limit=100)[source]¶ Lists members of a channel
- Parameters
channel (str) – The channel ID
cursor (str) – the cursor id of the next set of the list
limit (int) – The number of messages to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
members_all(channel)[source]¶ Lists all members of a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
now= time.struct_time(tm_year=2021, tm_mon=4, tm_mday=19, tm_hour=19, tm_min=38, tm_sec=30, tm_wday=0, tm_yday=109, tm_isdst=-1)¶
-
open(channel, return_im=True, users=[])[source]¶ Opens or resumes DMs or multi person DMs
- Parameters
channel (str) – The channel ID
return_im (bool) – Indicates you wnat the full IM channel definition in the response
user_ids (list[str]) – A list of User IDs to invite to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a channel
- Parameters
channel (str) – The channel ID to rename
name (str) – The new name of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, time_stamp, cursor=None, inclusive=False, limit=100, latest=1618861110.40856, oldest=0)[source]¶ Fetches replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
cursor (str) – the cursor id of the next set of replies
inclusive (bool) – Include messages with latest or oldest timestamp in results
limit (int) – The number of messages to return
latest (str) – End of time range to include in results
latest – Start of time range to include in results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies_all(channel, time_stamp)[source]¶ Fetches all replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
setPurpose(channel, purpose)[source]¶ Assigns purpose to a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The new purpose of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
setTopic(channel, topic)[source]¶ Assigns topic to a channel
- Parameters
channel (str) – The channel ID
topic (str) – The new topic of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
timestamp= 1618861110.40856¶
-
-
class
slackest.Channels(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Channels API. See https://api.slack.com/methods
-
archive(channel)[source]¶ Archives a public channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create(name)[source]¶ Creates a public channel
- Parameters
name (str) – The name
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channel_id(channel_name)[source]¶ Gets a channel ID according to the channel’s name
- Parameters
channel_name (str) – The channel’s name
- Returns
Returns the channel ID
- Return type
str
-
history(channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False)[source]¶ Fetches history of messages and events from a channel
- Parameters
channel (str) – The channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
count (int) – The number of messages to return
inclusive (bool) – Include messages with latest or oldest timestamp in results
unreads (bool) – Include unread_count_display in the output
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(channel)[source]¶ Retrieves information about a public channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
invite(channel, user)[source]¶ Invites a user to a private channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
join(name)[source]¶ Allows a user object to join a channel
- Parameters
name (str) – The channel name (#general)
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The private channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
leave(channel)[source]¶ Allows a user object to leave a channel
- Parameters
name (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(exclude_archived=True, exclude_members=False)[source]¶ Lists channels
- Parameters
exclude_archived (bool) – Exclude archived channels
exclude_members (bool) – Exclude members from being listed
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Moves the read cursor in a public channel
- Parameters
channel (str) – The channel ID
time_stamp (str) – The timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
rename(channel, name)[source]¶ Renames a channel
- Parameters
channel (str) – The channel ID
name (str) – The new user-friendly name of the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
replies(channel, thread_ts)[source]¶ Retrieve a thread of messages posted to a channel
- Parameters
channel (str) – The channel ID
thread_ts (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose of a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The purpose
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Chat(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Chat API. See https://api.slack.com/methods
-
command(channel, command, text)[source]¶ DEPRECATED? Run a command in a chat
- Parameters
channel (str) – The channel ID
command (str) – The command to run
text (str) – The text attached to the command
- Returns
A response object to run the API request.
- Return type
Responseobject
-
delete(channel, time_stamp, as_user=False)[source]¶ Delete a message
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to be deleted
as_user (bool) – Deletes the message as the authed user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_permalink(channel, message_ts)[source]¶ Retrieve a permalink URL for a specific extant message
- Parameters
channel –
message_ts –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
me_message(channel, text)[source]¶ Share a me message to a channel
- Parameters
channel (str) – The channel to post to
text (str) – The text of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_ephemeral(channel, text, user, as_user=False, attachments=None, link_names=True, parse=None)[source]¶ Sends an ephemeral message to a user in a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to send
user (str) – The user ID
as_user (bool) – Posts the message as the authed user
attachments (JSON) – JSON array of structured attachments
link_names (str) – Link channel names and users
parse (str) – Change how messages are treated
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message(channel, text=None, username=None, as_user=False, parse=None, link_names=None, attachments=None, unfurl_links=None, unfurl_media=None, icon_url=None, icon_emoji=None, thread_ts=None, reply_broadcast=False)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to post
username (str) – The username to post as, must be used w/ as_user
as_user (bool) – Posts as the user instead of a bot
parse (str) – Change how messages are treated
link_names (str) – Find and link channel names and username
attachments (JSON) – JSON based array of structured attachments
unfurl_links (str) – Enable unfurling of links
unfurl_media (str) – Enable unfurling of media
icon_url (str) – The icon URL
icon_emoji (str) – Emoji to use as the icon for this message
thread_ts (str) – Provide another messages ts value to make this message a reply
reply_broadcast (bool) – Indicates whether reply should be visible in the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message_basic(channel, text=None, link_names=None)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
text (str) – Text of the message to post
link_names (str) – Find and link channel names and username
- Returns
A response object to run the API request.
- Return type
Responseobject
-
unfurl(channel, time_stamp, unfurls, user_auth_message=None, user_auth_required=False, user_auth_url=None)[source]¶ Provides custom unfurl behavior for user posted URLS
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to add unfurl behavior
unfurls (JSON) – JSON map with keys set to URLS in the message
user_auth_message (str) – Invitation to user to use Slack app
user_auth_required (bool) – Slack app required
user_auth_unfurl (str) – URL for completion
- Returns
A response object to run the API request.
- Return type
Responseobject
-
update(channel, time_stamp, text, attachments=None, parse=None, link_names=None, as_user=False)[source]¶ Updates a message in a channel
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the message to be updated
text (str) – New text for the message
attachments (JSON) – JSON array of structured attachments
parse (str) – Change hor messages are treated
link_names (str) – Find and link channel names
as_user (bool) – Update the message as the authed user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.IM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack IM API. See https://api.slack.com/methods
-
close(channel)[source]¶ Close a DM channel
- Parameters
channel –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, count=None, inclusive=True, unreads=False)[source]¶ Fetches history of messages and events from a DM channel
- Parameters
channel (str) – The channel ID
latest (str) – End of time range of messages to include in results
oldest (str) – Start of time range of messages to include in results
count (int) – Number of messages to return
inclusive (bool) – Include messages with oldest/latest inclusive
unreads (bool) – Include unread count display
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list()[source]¶ Lists direct messages for the calling user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Sets the read cursor in a DM
- Parameters
channel (str) – The channel ID
time_stamp (str) – Timestamp of the most recently seen message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
open(user, include_locale=True, return_im=True)[source]¶ Opens a DM channel
- Parameters
user (str) – User to open a DM channel with
include_locale (str) – Receive locales for this DM
return_im (True) – Return the full IM channel definition
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.IncomingWebhook(url=None, timeout=10, proxies=None)[source]¶ Bases:
objectFollows the Slack IncomingWebhook API. See https://api.slack.com/methods
-
post(data)[source]¶ Posts message with payload formatted in accordance with this documentation https://api.slack.com/incoming-webhooks
- Parameters
data (A JSON representation of the payload) – The data payload
- Returns
A response object to run the request.
- Return type
Responseobject
-
-
class
slackest.Search(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Search API. See https://api.slack.com/methods
-
all(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for messages and files matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
files(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for files matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
messages(query, sort=None, sort_dir=None, highlight=True, count=None, page=None)[source]¶ Searches for messages matching a query
- Parameters
query (str) – Search query
sort (str) – Sort by score or timestamp
sort_dir (str) – Sort direction asc or desc
highlight (str) – Enable highlight markers
count (int) – Number of items to return
page (int) – Page number of results to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Files(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Files API. See https://api.slack.com/methods
-
comments¶
-
delete(file_)[source]¶ Deletes a file
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info(file_, count=None, page=None, cursor=None, limit=100)[source]¶ Gents information about a file
- Parameters
file (str) – The file ID
count (int) – Number of items to return
page (int) – Page number of results to return
cursor (str) – The parameter for pagination
limit (int) – Max number of items to return
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, ts_from=None, ts_to=None, types=None, count=None, page=None, channel=None)[source]¶ List of files within a team
- Parameters
user (str) – Filter files to this user ID
ts_from (str) – Timestamp from = after
ts_to (str) – Timestamp to = before
types (str) – Filter files by type
count (int) – Number of items to return
page (int) – Page number of results to return
channel (str) – Filter files to this channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
revoke_public_url(file_)[source]¶ Revokes public sharing
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
Enables public sharing
- Parameters
file (str) – The file ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
upload(file_=None, content=None, filetype=None, filename=None, title=None, initial_comment=None, channels=None, thread_ts=None)[source]¶ Uploads or creates a file
- Parameters
file (str) – The file ID
content (binary) – File contents via a POST variable
filetype (str) – File type identifier
filename (str) – File name
title (str) – Title of the file
initial_comment (str) – Comment on the file
channels (list[str]) – CSV of channel names to post to
thread_ts (str) – Parent thread to use in a reply
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Stars(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Stars API. See https://api.slack.com/methods
-
add(file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Adds a star to an item
- Parameters
file (str) – The file ID
file_comment (str) – The comment on the file
channel (str) – The channel ID
timestamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, count=None, page=None)[source]¶ Lists stars for a user
:param : :type : :return: A response object to run the API request. :rtype:
Responseobject
-
remove(file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Removes a star from an item
- Parameters
file (str) – The file ID
file_comment (str) – The comment on the file
channel (str) – The channel ID
timestamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Emoji(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Emoji API. See https://api.slack.com/methods
-
class
slackest.Presence(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Presence API. See https://api.slack.com/methods
-
ACTIVE= 'active'¶
-
AWAY= 'away'¶
-
TYPES= ('away', 'active')¶
-
-
class
slackest.RTM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack RTM API. See https://api.slack.com/methods
-
connect()[source]¶ Start a Real Time Messaging session
- Returns
A response object to run the API request.
- Return type
Responseobject
-
start(simple_latest=True, no_unreads=False, mpim_aware=False)[source]¶ Start a Real Time Messaging session
- Parameters
simple_latest (bool) – Return timestamp only for latest message object
no_unreads (bool) – Skip unread counts
mpim_aware (bool) – Returns MPIMs to the client
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Team(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Team API. See https://api.slack.com/methods
-
access_logs(count=None, page=None, before=None)[source]¶ Gets the access log for the current team
- Parameters
count (int) – Number of items to return in the page
page (int) – The page number of results
before (int) – End time range of logs to include
- Returns
A response object to run the API request.
- Return type
Responseobject
-
billable_info(user=None)[source]¶ Gets billable users information
- Parameters
user –
- Returns
A response object to run the API request.
- Return type
Responseobject
-
info()[source]¶ Gets information about the current team
- Returns
A response object to run the API request.
- Return type
Responseobject
-
integration_logs(service_id=None, app_id=None, user=None, change_type=None, count=None, page=None)[source]¶ Gets the integration logs for the current team
- Parameters
service_id (str) – Filter logs to this service
app_id (str) – Filter logs to this slack app
user (str) – Filter logs generated by this user
change_type (str) – Filter logs to this change type
count (int) – Number of items to return per page
page (int) – The page number of results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
profile¶
-
-
class
slackest.Reactions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Reactions API. See https://api.slack.com/methods
-
add(name, file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Adds a reaction to an item
- Parameters
name (str) – Reaction name
file (str) – File to add reaction to
file_comment (str) – File comment to add reaction to
channel (str) – Channel where the message to add reaction
timestamp (str) – Timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get(file_=None, file_comment=None, channel=None, timestamp=None, full=None)[source]¶ Gets reactions for an item
- Parameters
file (str) – File to get reaction
file_comment (str) – File comment to get reaction
channel (str) – Channel where the message to get reaction
timestamp (str) – Timestamp of the message
full (str) – Return complete reaction list
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(user=None, full=None, count=None, page=None)[source]¶ List reactions made by a user
- Parameters
user (str) – User ID to list reactions
full (str) – Return complete reaction list
count (int) – Number of items to return on the page
page (int) – Page number of results
- Returns
A response object to run the API request.
- Return type
Responseobject
-
remove(name, file_=None, file_comment=None, channel=None, timestamp=None)[source]¶ Removes a reaction from an item
- Parameters
name (str) – Reaction name
file (str) – File to remove reaction
file_comment (str) – File comment to remove reaction
channel (str) – Channel where the message to remove reaction
timestamp (str) – Timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Pins(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Pins API. See https://api.slack.com/methods
-
add(channel, file_=None, file_comment=None, timestamp=None)[source]¶ Pins an item to a channel
- Parameters
channel (str) – The channel ID
file (str) – The File ID to add
file_comment (str) – The file comment ID to add
timestamp (str) – Timestamp of the message to add
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list(channel)[source]¶ Lists items pinned to a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
remove(channel, file_=None, file_comment=None, timestamp=None)[source]¶ Un-pins an item from a channel
- Parameters
channel (str) – The channel ID
file (str) – The File ID to remove
file_comment (str) – The file comment ID to remove
timestamp (str) – Timestamp of the message to remove
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.UserGroups(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UserGroups API. See https://api.slack.com/methods
-
create(name, handle=None, description=None, channels=None, include_count=False)[source]¶ Creates a new usergroup
- Parameters
name (str) – A name for the usergroup
handle (str) – The mention handle
description (str) – Description of the usergroup
channels (list[str]) – CSV of channel IDs for the usergroup
include_count (bool) – Include the number of users in the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
disable(usergroup, include_count=True)[source]¶ Disable a UserGroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
include_count (bool) – Include the number of users
- Returns
A response object to run the request.
- Return type
Responseobject
-
enable(usergroup, include_count=True)[source]¶ Enable a UserGroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
include_count (bool) – Include the number of users
- Returns
A response object to run the request.
- Return type
Responseobject
-
list(include_disabled=False, include_count=False, include_users=False)[source]¶ Lists all of the usergroups
- Parameters
include_disabled (bool) – Include disabled usergroups
include_count (bool) – Include the number of users in the usergroup
include_users (bool) – Include the list of users of the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
update(usergroup, name=None, handle=None, description=None, channels=None, include_count=True)[source]¶ Update an existing usergroup
- Parameters
usergroup (str) – The encoded ID of the usergroup
name (str) – A name for the usergroup
handle (str) – The mention handle
description (str) – Description of the usergroup
channels (list[str]) – CSV of channel IDs for the usergroup
include_count (bool) – Include the number of users in the usergroup
- Returns
A response object to run the request.
- Return type
Responseobject
-
users¶
-
-
class
slackest.UserGroupsUsers(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UserGroupUsers API. See https://api.slack.com/methods
-
list(usergroup, include_disabled=False)[source]¶ Lists all users in a usergroup
- Parameters
usergroup (str) – The usergroup ID
include_disabled (bool) – Include disabled users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
update(usergroup, users, include_count=False)[source]¶ Updates the list of users for a usergroup
- Parameters
usergroup (str) – The usergroup ID
users (list[str]) – CSV of user IDs to add
include_count (bool) – Include a count of users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.MPIM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack MPIM API. See https://api.slack.com/methods
-
close(channel)[source]¶ Closes a MPIM
- Parameters
channel (str) – the channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history(channel, latest=None, oldest=None, inclusive=False, count=None, unreads=False)[source]¶ Fetches a history of messages and events
- Parameters
channel (str) – The channel ID
latest (str) – End of time range to include in results
oldest (str) – Start of time range to include in results
inclusive (str) – Include latest/oldest messags
count (int) – Number of messages to return
unreads (str) – Include count display
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list()[source]¶ Lists MPIM for the calling user
- Returns
A response object to run the API request.
- Return type
Responseobject
-
mark(channel, time_stamp)[source]¶ Sets the read cursor in a MPIM
- Parameters
channel (str) – The channel ID
time_stamp (str) – The timestamp of the message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.OAuth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack OAuth API. See https://api.slack.com/methods
-
access(client_id, client_secret, code, redirect_uri=None)[source]¶ Exchanges a temporary OAuth verifier code for an access token
- Parameters
client_id (str) – Issued when you created your application
client_secret (str) – Issued when you created your application.
code (str) – Code para returned via the callback
redirect_uri (str) – URL to land on
- Returns
A response object to run the API request.
- Return type
Responseobject
-
token(client_id, client_secret, code, redirect_uri=None, single_channel=None)[source]¶ Exchanges a temporary OAuth verifier code for a workspace token
- Parameters
client_id (str) – Issued when you created your application
client_secret (str) – Issued when you created your application.
code (str) – Code para returned via the callback
redirect_uri (str) – URL to land on
single_channel (str) – Request the user to add the app only to a single channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.DND(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack DND API. See https://api.slack.com/methods
-
end_dnd()[source]¶ Ends the current user’s DND session
- Returns
A response object to run the request.
- Return type
Responseobject
-
end_snooze()[source]¶ End’s the current user’s snooze
- Returns
A response object to run the request.
- Return type
Responseobject
-
info(user=None)[source]¶ Retrieves the current user’s DND status
- Parameters
user (str) – User ID to fetch status
- Returns
A response object to run the request.
- Return type
Responseobject
-
-
class
slackest.Bots(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Bots API. See https://api.slack.com/methods
-
class
slackest.FilesComments(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack FilesComments API. See https://api.slack.com/methods
-
add(file_, comment)[source]¶ DEPRECATED - Adds a comment to a file
- Parameters
file (str) – The file ID
comment (str) – Text of the comment
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Reminders(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Reminders API. See https://api.slack.com/methods
-
add(text, reminder_time, user=None)[source]¶ Creates a reminder
- Parameters
text (str) – Content of the reminder
reminder_time (int) – Unix timestamp to show the reminder
user (str) – User ID attached to the reminder
- Returns
A response object to run the request.
- Return type
Responseobject
-
complete(reminder)[source]¶ Mark the reminder as completed
- Parameters
reminder (str) – The reminder ID
- Returns
A response object to run the request.
- Return type
Responseobject
-
delete(reminder)[source]¶ Deletes a reminder
- Parameters
reminder (str) – The reminder ID
- Returns
A response object to run the request.
- Return type
Responseobject
-
-
class
slackest.TeamProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack TeamProfile API. See https://api.slack.com/methods
-
class
slackest.UsersProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack UsersProfile API. See https://api.slack.com/methods
-
get(user=None, include_labels=False)[source]¶ Gets a Slack user’s profile
- Parameters
user (str) – User to retrieve profile info for
include_labels (bool) – Include labels for each ID in custom profile fields
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set(user=None, profile=None, name=None, value=None)[source]¶ Gets a Slack user’s profile
- Parameters
user (str) – ID of user to change
profile (str) – Collection of key:value pairs presented as a URL-encoded JSON hash
name (str) – Name of a single key to set
value (str) – Value to set a single key to
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.IDPGroups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack IDPGroups API. See https://api.slack.com/methods
-
class
slackest.Apps(*args, **kwargs)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Apps API. See https://api.slack.com/methods
-
permissions¶
-
-
class
slackest.AppsPermissions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack AppsPermissions API. See https://api.slack.com/methods
-
class
slackest.Slackest(token, incoming_webhook_url=None, timeout=10, http_proxy=None, https_proxy=None, session=None, rate_limit_retries=0)[source]¶ Bases:
objectThe main Slackest work horse. Surfaces some convenience methods but mostly interfaces with the auxilary classes.
-
add_member_to_channel(channel, member)[source]¶ Invites a user to a channel
- Parameters
channel (str) – The channel ID
user (str) – A user ID to invite to a channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
create_channel(name, is_private=True, users=[])[source]¶ Creates a channel
- Parameters
name (str) – The channel name
is_private (bool) – Determines if channel is private (like a group)
user_ids (list[str]) – A list of User IDs to add to the channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channel_info(channel)[source]¶ Gets information about a channel.
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_channels(exclude_archive, types)[source]¶ Lists all channels
- Parameters
exclude_archived (bool) – Exclude archived channels
types (str) – The type of channel to return, can be one of public_channel, private_channel
- Returns
A response object to run the API request.
- Return type
Responseobject
-
get_replies(channel, time_stamp)[source]¶ Fetches all replies in a thread of messages
- Parameters
channel (str) – The channel ID
time_stamp (str) – Unique identifier of a thread’s parent message
- Returns
A response object to run the API request.
- Return type
Responseobject
-
history_all(channel)[source]¶ Fetches all history of messages and events from a channel
- Parameters
channel (str) – The channel ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
kick_user(channel, user)[source]¶ Removes a user from a channel
- Parameters
channel (str) – The channel ID
user (str) – The user ID
- Returns
A response object to run the API request.
- Return type
Responseobject
-
list_all_users()[source]¶ Lists all users
- Returns
A response object to run the API request.
- Return type
Responseobject
-
oauth= <slackest.oauth.OAuth object>¶
-
post_message_to_channel(channel, message)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
message (str) – The message text
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_message_to_channel_basic(channel, message)[source]¶ Posts a message to a channel
- Parameters
channel (str) – The channel ID
message (str) – The message text
- Returns
A response object to run the API request.
- Return type
Responseobject
-
post_thread_to_message(channel, message, thread_ts)[source]¶ - Parameters
channel (str) – The channel ID
message (str) – The message text
thread_ts (str) – The parent thread timestamp identifier
- Returns
A response object to run the API request.
- Return type
Responseobject
-
set_purpose(channel, purpose)[source]¶ Sets the purpose a channel
- Parameters
channel (str) – The channel ID
purpose (str) – The purpose to set
- Returns
A response object to run the API request.
- Return type
Responseobject
-
-
class
slackest.Dialog(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]¶ Bases:
slackest.base_api.BaseAPIFollows the Slack Dialog API. See https://api.slack.com/methods