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.BaseAPI

Follows the Slack Test API. See https://api.slack.com/methods

test(error=None, **kwargs)[source]

Allows access to the Slack API test endpoint

Parameters
  • error (str) – The API error

  • kwargs (dict) – Various keyword arguments that could be passed to the request

Returns

A response object to run the API request.

Return type

Response object

slackest.apps module

class slackest.apps.Apps(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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.BaseAPI

Follows the Slack AppsPermissions API. See https://api.slack.com/methods

info()[source]

All current permissions this app has (deprecated)

Returns

A response object to run the API request.

Return type

Response object

request(scopes, trigger_id)[source]

All current permissions this app has

Parameters
  • scopes (list[str]) – A comma separated list of scopes to request for

  • trigger_id (str) – Token used to trigger the permissions API

Returns

A response object to run the API request.

Return type

Response object

slackest.auth module

class slackest.auth.Auth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Auth API. See https://api.slack.com/methods

revoke(test=True)[source]

Allows access to the Slack API test endpoint

Parameters

test (bool) – Boolean to run the test

Returns

A response object to run the API request.

Return type

Response object

test()[source]

Allows access to the Slack API test endpoint

Returns

A response object to run the API request.

Return type

Response object

slackest.base_api module

class slackest.base_api.BaseAPI(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: object

BaseAPI interface for making the requests calls to Slack.

get(api, **kwargs)[source]

External request GET call, wraps around internal _request.get

Parameters
  • api (str) – The API endpoint to connect to

  • kwargs (dict) – Various keyword arguments that could be passed to the GET

Returns

A response object to run the API request.

Return type

Response object

post(api, **kwargs)[source]

External request POST call, wraps around internal _request.post

Parameters
  • api (str) – The API endpoint to connect to

  • kwargs (dict) – Various keyword arguments that could be passed to the POST

Returns

A response object to run the API request.

Return type

Response object

slackest.bots module

class slackest.bots.Bots(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Bots API. See https://api.slack.com/methods

info(bot=None)[source]

Gets information about a bot user

Parameters

bot (str) – Bot user ID

Returns

A response object to run the request.

Return type

Response object

slackest.channels module

class slackest.channels.Channels(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

create(name)[source]

Creates a public channel

Parameters

name (str) – The name

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic of a channel

Parameters
  • channel (str) – The channel ID

  • topic (str) – The topic

Returns

A response object to run the API request.

Return type

Response object

unarchive(channel)[source]

Unarchives a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

slackest.chat module

class slackest.chat.Chat(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

Retrieve a permalink URL for a specific extant message

Parameters
  • channel

  • message_ts

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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.BaseAPI

Follows 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

Response object

close(channel)[source]

Closes a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

timestamp = 1618861110.40856
unarchive(channel)[source]

Unarchives a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

slackest.dialog module

class slackest.dialog.Dialog(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Dialog API. See https://api.slack.com/methods

open(dialog, trigger_id)[source]

Opens a dialog with a user

Parameters
  • dialog (json) – JSON-encoded dialog definition

  • trigger_id (str) – The trigger to post to the user.

Returns

A response object to run the API request.

Return type

Response object

slackest.dnd module

class slackest.dnd.DND(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

end_snooze()[source]

End’s the current user’s snooze

Returns

A response object to run the request.

Return type

Response object

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

Response object

set_snooze(num_minutes)[source]

The number of minutes to snooze

Parameters

num_minutes (int) – The number of minutes to snooze

Returns

A response object to run the request.

Return type

Response object

team_info(users=[])[source]

Provides info about DND for a list of users on a Slack team

Parameters

users (list[str]) – The list of user ids

Returns

A response object to run the request.

Return type

Response object

slackest.emoji module

class slackest.emoji.Emoji(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Emoji API. See https://api.slack.com/methods

list()[source]

List all emojis

Returns

A response object to run the API request.

Return type

Response object

slackest.files module

class slackest.files.Files(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

shared_public_url(file_)[source]

Enables public sharing

Parameters

file (str) – The file ID

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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.BaseAPI

Follows 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

Response object

delete(file_, id)[source]

Deletes a comment on a file

Parameters
  • file (str) – File to delete a comment from

  • id (str) – The comment ID

Returns

A response object to run the API request.

Return type

Response object

edit(file_, id, comment)[source]

DEPRECATED - Edits a comment to a file

Parameters
  • file (str) – File to delete a comment from

  • id (str) – The comment ID

  • comment (str) – Text of the comment

Returns

A response object to run the API request.

Return type

Response object

slackest.groups module

class slackest.groups.Groups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic of a private channel

Parameters
  • channel (str) – The private channel ID

  • topic (str) – The topic

Returns

A response object to run the API request.

Return type

Response object

unarchive(channel)[source]

Unarchives a private channel

Parameters

channel (str) – The private channel ID

Returns

A response object to run the API request.

Return type

Response object

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.BaseAPI

Follows the Slack IDPGroups API. See https://api.slack.com/methods

list(include_users=False)[source]

DEPRECATED? This class will be removed in the next major release.

:param : :type : :return : :rtype:

slackest.im module

class slackest.im.IM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

list()[source]

Lists direct messages for the calling user

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

replies(channel, thread_ts)[source]

Retrieves a thread of messages posted to a DM

Parameters
  • channel (str) – The channel ID

  • thread_ts (str) – Unique ID of thread’s parent message

Returns

A response object to run the API request.

Return type

Response object

slackest.incoming_webhook module

class slackest.incoming_webhook.IncomingWebhook(url=None, timeout=10, proxies=None)[source]

Bases: object

Follows 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

Response object

slackest.mpim module

class slackest.mpim.MPIM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

list()[source]

Lists MPIM for the calling user

Returns

A response object to run the API request.

Return type

Response object

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

Response object

open(users=[])[source]

Opens a MPIM with a list of users

Parameters

users (list[str]) – A list of user IDs

Returns

A response object to run the API request.

Return type

Response object

replies(channel, thread_ts)[source]

Retrieves a thread of messages posted to MPIM

Parameters
  • channel (str) – The channel ID

  • thread_ts (str) – Thread’s parent message

Returns

A response object to run the API request.

Return type

Response object

slackest.oauth module

class slackest.oauth.OAuth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

slackest.pins module

class slackest.pins.Pins(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

slackest.presence module

class slackest.presence.Presence(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Presence API. See https://api.slack.com/methods

ACTIVE = 'active'
AWAY = 'away'
TYPES = ('away', 'active')
set(presence)[source]

DEPRECATED - Sets the precense of a user

Parameters

presence (str) – The status

Returns

A response object to run the API request.

Return type

Response object

slackest.reactions module

class slackest.reactions.Reactions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

slackest.reminders module

class slackest.reminders.Reminders(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

complete(reminder)[source]

Mark the reminder as completed

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

delete(reminder)[source]

Deletes a reminder

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

info(reminder)[source]

Returns information about a reminder

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

list()[source]

Returns a list of reminders created by or for a given user

:param : :type : :return: A response object to run the request. :rtype: Response object

slackest.response module

class slackest.response.Response(body)[source]

Bases: object

Requests response object

slackest.rtm module

class slackest.rtm.RTM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

slackest.search module

class slackest.search.Search(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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: object

The 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

list_all_users()[source]

Lists all users

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic a channel

Parameters
  • channel (str) – The channel ID

  • topic (str) – The topic to set

Returns

A response object to run the API request.

Return type

Response object

upload_file(filename, channels)[source]

Uploads a file to a channel

Parameters
  • filename (str) – The filename to upload

  • channels (list[str]) – Channel IDs to upload to

Returns

A response object to run the API request.

Return type

Response object

slackest.slackest_error module

exception slackest.slackest_error.SlackestError[source]

Bases: Exception

Dummy exception placeholder

slackest.stars module

class slackest.stars.Stars(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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: Response object

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

Response object

slackest.team module

class slackest.team.Team(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

billable_info(user=None)[source]

Gets billable users information

Parameters

user

Returns

A response object to run the API request.

Return type

Response object

info()[source]

Gets information about the current team

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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.BaseAPI

Follows the Slack TeamProfile API. See https://api.slack.com/methods

get(visibility=None)[source]

Retrieves a team’s profile

Parameters

visibility (str) – Filter by visibility

Returns

A response object to run the API request.

Return type

Response object

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.BaseAPI

Follows 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

Response object

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

Response object

slackest.user_groups module

class slackest.user_groups.UserGroups(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

users

slackest.users module

class slackest.users.Users(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

profile

Returns the profile object attribute

Returns

A usersprofile object.

Return type

UsersProfile object

set_active()[source]

Sets the user object to active. DEPRECATED

Returns

A response object to run the API request.

Return type

Response object

set_presence(presence)[source]

Sets the presence of the current Slack user

Parameters

presence (str) – The presence level of the user: either auto or away

Returns

A response object to run the API request.

Return type

Response object

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.BaseAPI

Follows 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

Response object

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.BaseAPI

Follows 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

Response object

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

Response object

slackest.utils module

slackest.utils.get_item_id_by_name(list_dict, key_name)[source]

Module contents

exception slackest.SlackestError[source]

Bases: Exception

Dummy exception placeholder

class slackest.Response(body)[source]

Bases: object

Requests response object

class slackest.BaseAPI(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: object

BaseAPI interface for making the requests calls to Slack.

get(api, **kwargs)[source]

External request GET call, wraps around internal _request.get

Parameters
  • api (str) – The API endpoint to connect to

  • kwargs (dict) – Various keyword arguments that could be passed to the GET

Returns

A response object to run the API request.

Return type

Response object

post(api, **kwargs)[source]

External request POST call, wraps around internal _request.post

Parameters
  • api (str) – The API endpoint to connect to

  • kwargs (dict) – Various keyword arguments that could be passed to the POST

Returns

A response object to run the API request.

Return type

Response object

class slackest.API(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Test API. See https://api.slack.com/methods

test(error=None, **kwargs)[source]

Allows access to the Slack API test endpoint

Parameters
  • error (str) – The API error

  • kwargs (dict) – Various keyword arguments that could be passed to the request

Returns

A response object to run the API request.

Return type

Response object

class slackest.Auth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Auth API. See https://api.slack.com/methods

revoke(test=True)[source]

Allows access to the Slack API test endpoint

Parameters

test (bool) – Boolean to run the test

Returns

A response object to run the API request.

Return type

Response object

test()[source]

Allows access to the Slack API test endpoint

Returns

A response object to run the API request.

Return type

Response object

class slackest.Users(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

profile

Returns the profile object attribute

Returns

A usersprofile object.

Return type

UsersProfile object

set_active()[source]

Sets the user object to active. DEPRECATED

Returns

A response object to run the API request.

Return type

Response object

set_presence(presence)[source]

Sets the presence of the current Slack user

Parameters

presence (str) – The presence level of the user: either auto or away

Returns

A response object to run the API request.

Return type

Response object

class slackest.Groups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic of a private channel

Parameters
  • channel (str) – The private channel ID

  • topic (str) – The topic

Returns

A response object to run the API request.

Return type

Response object

unarchive(channel)[source]

Unarchives a private channel

Parameters

channel (str) – The private channel ID

Returns

A response object to run the API request.

Return type

Response object

class slackest.Conversation(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

close(channel)[source]

Closes a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

timestamp = 1618861110.40856
unarchive(channel)[source]

Unarchives a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

class slackest.Channels(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

create(name)[source]

Creates a public channel

Parameters

name (str) – The name

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic of a channel

Parameters
  • channel (str) – The channel ID

  • topic (str) – The topic

Returns

A response object to run the API request.

Return type

Response object

unarchive(channel)[source]

Unarchives a channel

Parameters

channel (str) – The channel ID

Returns

A response object to run the API request.

Return type

Response object

class slackest.Chat(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

Retrieve a permalink URL for a specific extant message

Parameters
  • channel

  • message_ts

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

class slackest.IM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

list()[source]

Lists direct messages for the calling user

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

replies(channel, thread_ts)[source]

Retrieves a thread of messages posted to a DM

Parameters
  • channel (str) – The channel ID

  • thread_ts (str) – Unique ID of thread’s parent message

Returns

A response object to run the API request.

Return type

Response object

class slackest.IncomingWebhook(url=None, timeout=10, proxies=None)[source]

Bases: object

Follows 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

Response object

class slackest.Search(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

class slackest.Files(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

shared_public_url(file_)[source]

Enables public sharing

Parameters

file (str) – The file ID

Returns

A response object to run the API request.

Return type

Response object

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

Response object

class slackest.Stars(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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: Response object

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

Response object

class slackest.Emoji(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Emoji API. See https://api.slack.com/methods

list()[source]

List all emojis

Returns

A response object to run the API request.

Return type

Response object

class slackest.Presence(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Presence API. See https://api.slack.com/methods

ACTIVE = 'active'
AWAY = 'away'
TYPES = ('away', 'active')
set(presence)[source]

DEPRECATED - Sets the precense of a user

Parameters

presence (str) – The status

Returns

A response object to run the API request.

Return type

Response object

class slackest.RTM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

class slackest.Team(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

billable_info(user=None)[source]

Gets billable users information

Parameters

user

Returns

A response object to run the API request.

Return type

Response object

info()[source]

Gets information about the current team

Returns

A response object to run the API request.

Return type

Response object

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

Response object

profile
class slackest.Reactions(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

class slackest.Pins(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

class slackest.UserGroups(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

users
class slackest.UserGroupsUsers(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

class slackest.MPIM(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

list()[source]

Lists MPIM for the calling user

Returns

A response object to run the API request.

Return type

Response object

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

Response object

open(users=[])[source]

Opens a MPIM with a list of users

Parameters

users (list[str]) – A list of user IDs

Returns

A response object to run the API request.

Return type

Response object

replies(channel, thread_ts)[source]

Retrieves a thread of messages posted to MPIM

Parameters
  • channel (str) – The channel ID

  • thread_ts (str) – Thread’s parent message

Returns

A response object to run the API request.

Return type

Response object

class slackest.OAuth(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

class slackest.DND(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

end_snooze()[source]

End’s the current user’s snooze

Returns

A response object to run the request.

Return type

Response object

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

Response object

set_snooze(num_minutes)[source]

The number of minutes to snooze

Parameters

num_minutes (int) – The number of minutes to snooze

Returns

A response object to run the request.

Return type

Response object

team_info(users=[])[source]

Provides info about DND for a list of users on a Slack team

Parameters

users (list[str]) – The list of user ids

Returns

A response object to run the request.

Return type

Response object

class slackest.Bots(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Bots API. See https://api.slack.com/methods

info(bot=None)[source]

Gets information about a bot user

Parameters

bot (str) – Bot user ID

Returns

A response object to run the request.

Return type

Response object

class slackest.FilesComments(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

delete(file_, id)[source]

Deletes a comment on a file

Parameters
  • file (str) – File to delete a comment from

  • id (str) – The comment ID

Returns

A response object to run the API request.

Return type

Response object

edit(file_, id, comment)[source]

DEPRECATED - Edits a comment to a file

Parameters
  • file (str) – File to delete a comment from

  • id (str) – The comment ID

  • comment (str) – Text of the comment

Returns

A response object to run the API request.

Return type

Response object

class slackest.Reminders(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

complete(reminder)[source]

Mark the reminder as completed

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

delete(reminder)[source]

Deletes a reminder

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

info(reminder)[source]

Returns information about a reminder

Parameters

reminder (str) – The reminder ID

Returns

A response object to run the request.

Return type

Response object

list()[source]

Returns a list of reminders created by or for a given user

:param : :type : :return: A response object to run the request. :rtype: Response object

class slackest.TeamProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack TeamProfile API. See https://api.slack.com/methods

get(visibility=None)[source]

Retrieves a team’s profile

Parameters

visibility (str) – Filter by visibility

Returns

A response object to run the API request.

Return type

Response object

class slackest.UsersProfile(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows 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

Response object

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

Response object

class slackest.IDPGroups(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack IDPGroups API. See https://api.slack.com/methods

list(include_users=False)[source]

DEPRECATED? This class will be removed in the next major release.

:param : :type : :return : :rtype:

class slackest.Apps(*args, **kwargs)[source]

Bases: slackest.base_api.BaseAPI

Follows 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.BaseAPI

Follows the Slack AppsPermissions API. See https://api.slack.com/methods

info()[source]

All current permissions this app has (deprecated)

Returns

A response object to run the API request.

Return type

Response object

request(scopes, trigger_id)[source]

All current permissions this app has

Parameters
  • scopes (list[str]) – A comma separated list of scopes to request for

  • trigger_id (str) – Token used to trigger the permissions API

Returns

A response object to run the API request.

Return type

Response object

class slackest.Slackest(token, incoming_webhook_url=None, timeout=10, http_proxy=None, https_proxy=None, session=None, rate_limit_retries=0)[source]

Bases: object

The 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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

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

Response object

list_all_users()[source]

Lists all users

Returns

A response object to run the API request.

Return type

Response object

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

Response object

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

Response object

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

Response object

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

Response object

set_topic(channel, topic)[source]

Sets the topic a channel

Parameters
  • channel (str) – The channel ID

  • topic (str) – The topic to set

Returns

A response object to run the API request.

Return type

Response object

upload_file(filename, channels)[source]

Uploads a file to a channel

Parameters
  • filename (str) – The filename to upload

  • channels (list[str]) – Channel IDs to upload to

Returns

A response object to run the API request.

Return type

Response object

class slackest.Dialog(token=None, timeout=10, proxies=None, session=None, rate_limit_retries=0)[source]

Bases: slackest.base_api.BaseAPI

Follows the Slack Dialog API. See https://api.slack.com/methods

open(dialog, trigger_id)[source]

Opens a dialog with a user

Parameters
  • dialog (json) – JSON-encoded dialog definition

  • trigger_id (str) – The trigger to post to the user.

Returns

A response object to run the API request.

Return type

Response object