Slack API client providing comprehensive Python interface for messaging, file sharing, user management, and team communication features.
—
Create, manage, and interact with public channels, private groups, and conversations using both legacy and modern Slack APIs.
Create and manage public channels within your workspace.
def create(self, name):
"""
Create a new public channel.
Args:
name (str): Channel name (without # prefix)
Returns:
Response: Created channel information including channel ID
"""
def info(self, channel):
"""
Get information about a channel.
Args:
channel (str): Channel ID or name
Returns:
Response: Channel details including members, topic, and purpose
"""
def list(self, exclude_archived=None, exclude_members=None):
"""
List all channels in workspace.
Args:
exclude_archived (bool, optional): Exclude archived channels
exclude_members (bool, optional): Exclude member lists
Returns:
Response: List of channels with metadata
"""
def join(self, name):
"""
Join an existing channel.
Args:
name (str): Channel name to join
Returns:
Response: Join confirmation and channel info
"""
def leave(self, channel):
"""
Leave a channel.
Args:
channel (str): Channel ID to leave
Returns:
Response: Leave confirmation
"""Retrieve and manage message history within channels.
def history(self, channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False):
"""
Retrieve channel message history.
Args:
channel (str): Channel ID
latest (str, optional): Latest message timestamp
oldest (str, optional): Oldest message timestamp
count (int, optional): Number of messages to return
inclusive (bool): Include messages with exact timestamps (default: False)
unreads (bool): Include unread count info (default: False)
Returns:
Response: Channel messages and metadata
"""
def mark(self, channel, ts):
"""
Mark a channel as read up to a certain point.
Args:
channel (str): Channel ID
ts (str): Timestamp to mark as read
Returns:
Response: Mark confirmation
"""
def replies(self, channel, thread_ts):
"""
Retrieve replies to a threaded message in a channel.
Args:
channel (str): Channel ID
thread_ts (str): Thread parent message timestamp
Returns:
Response: Thread replies with message details
"""Manage channel membership by inviting and removing users.
def invite(self, channel, user):
"""
Invite a user to a channel.
Args:
channel (str): Channel ID
user (str): User ID to invite
Returns:
Response: Invite confirmation
"""
def kick(self, channel, user):
"""
Remove a user from a channel.
Args:
channel (str): Channel ID
user (str): User ID to remove
Returns:
Response: Removal confirmation
"""Administrative functions for channel management.
def rename(self, channel, name):
"""
Rename a channel.
Args:
channel (str): Channel ID
name (str): New channel name
Returns:
Response: Rename confirmation with new channel info
"""
def archive(self, channel):
"""
Archive a channel.
Args:
channel (str): Channel ID to archive
Returns:
Response: Archive confirmation
"""
def unarchive(self, channel):
"""
Unarchive a channel.
Args:
channel (str): Channel ID to unarchive
Returns:
Response: Unarchive confirmation
"""
def set_purpose(self, channel, purpose):
"""
Set channel purpose.
Args:
channel (str): Channel ID
purpose (str): Channel purpose text
Returns:
Response: Purpose update confirmation
"""
def set_topic(self, channel, topic):
"""
Set channel topic.
Args:
channel (str): Channel ID
topic (str): Channel topic text
Returns:
Response: Topic update confirmation
"""Unified conversation management using Slack's modern API.
def create(self, name, user_ids=None, is_private=None):
"""
Create a new conversation (channel or group).
Args:
name (str): Conversation name
user_ids (list of str, optional): Initial user IDs to invite
is_private (bool, optional): Create as private conversation
Returns:
Response: Created conversation information
"""
def list(self, cursor=None, exclude_archived=None, types=None, limit=None):
"""
List conversations with cursor-based pagination.
Args:
cursor (str, optional): Pagination cursor
exclude_archived (bool, optional): Exclude archived conversations
types (list of str, optional): Conversation types to include
limit (int, optional): Maximum conversations per page
Returns:
Response: Conversations list with pagination info
"""
def members(self, channel, cursor=None, limit=None):
"""
List conversation members.
Args:
channel (str): Conversation ID
cursor (str, optional): Pagination cursor
limit (int, optional): Maximum members per page
Returns:
Response: Member list with pagination info
"""
def open(self, channel=None, users=None, return_im=None):
"""
Open a conversation.
Args:
channel (str, optional): Existing conversation ID
users (list of str, optional): User IDs for new conversation
return_im (bool, optional): Return IM channel if exists
Returns:
Response: Opened conversation information
"""Manage private group conversations (legacy API).
def create(self, name):
"""
Create a private group.
Args:
name (str): Group name
Returns:
Response: Created group information
"""
def create_child(self, channel):
"""
Create a child private group.
Args:
channel (str): Parent channel ID
Returns:
Response: Created child group information
"""
def open(self, channel):
"""
Open a private group.
Args:
channel (str): Group ID to open
Returns:
Response: Group open confirmation
"""
def close(self, channel):
"""
Close a private group.
Args:
channel (str): Group ID to close
Returns:
Response: Group close confirmation
"""
def info(self, channel):
"""
Get information about a private group.
Args:
channel (str): Group ID
Returns:
Response: Group details including members, topic, and purpose
"""
def list(self, exclude_archived=None):
"""
List private groups.
Args:
exclude_archived (bool, optional): Exclude archived groups
Returns:
Response: List of groups with metadata
"""
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None):
"""
Retrieve group message history.
Args:
channel (str): Group ID
latest (str, optional): Latest message timestamp
oldest (str, optional): Oldest message timestamp
count (int, optional): Number of messages to return
inclusive (bool, optional): Include messages with exact timestamps
Returns:
Response: Group messages and metadata
"""
def invite(self, channel, user):
"""
Invite a user to a private group.
Args:
channel (str): Group ID
user (str): User ID to invite
Returns:
Response: Invite confirmation
"""
def kick(self, channel, user):
"""
Remove a user from a private group.
Args:
channel (str): Group ID
user (str): User ID to remove
Returns:
Response: Removal confirmation
"""
def leave(self, channel):
"""
Leave a private group.
Args:
channel (str): Group ID to leave
Returns:
Response: Leave confirmation
"""
def mark(self, channel, ts):
"""
Mark a private group as read up to a certain point.
Args:
channel (str): Group ID
ts (str): Timestamp to mark as read
Returns:
Response: Mark confirmation
"""
def rename(self, channel, name):
"""
Rename a private group.
Args:
channel (str): Group ID
name (str): New group name
Returns:
Response: Rename confirmation with new group info
"""
def replies(self, channel, thread_ts):
"""
Retrieve replies to a threaded message in a private group.
Args:
channel (str): Group ID
thread_ts (str): Thread parent message timestamp
Returns:
Response: Thread replies with message details
"""
def archive(self, channel):
"""
Archive a private group.
Args:
channel (str): Group ID to archive
Returns:
Response: Archive confirmation
"""
def unarchive(self, channel):
"""
Unarchive a private group.
Args:
channel (str): Group ID to unarchive
Returns:
Response: Unarchive confirmation
"""
def set_purpose(self, channel, purpose):
"""
Set private group purpose.
Args:
channel (str): Group ID
purpose (str): Group purpose text
Returns:
Response: Purpose update confirmation
"""
def set_topic(self, channel, topic):
"""
Set private group topic.
Args:
channel (str): Group ID
topic (str): Group topic text
Returns:
Response: Topic update confirmation
"""def get_channel_id(self, channel_name):
"""
Get channel ID by name.
Args:
channel_name (str): Channel name to look up
Returns:
str or None: Channel ID if found, None otherwise
"""class Channels(BaseAPI):
"""Public channel management."""
def create(self, name): ...
def info(self, channel): ...
def list(self, exclude_archived=None, exclude_members=None): ...
def history(self, channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False): ...
def mark(self, channel, ts): ...
def join(self, name): ...
def leave(self, channel): ...
def invite(self, channel, user): ...
def kick(self, channel, user): ...
def rename(self, channel, name): ...
def replies(self, channel, thread_ts): ...
def archive(self, channel): ...
def unarchive(self, channel): ...
def set_purpose(self, channel, purpose): ...
def set_topic(self, channel, topic): ...
def get_channel_id(self, channel_name): ...
class Groups(BaseAPI):
"""Private group management."""
def create(self, name): ...
def create_child(self, channel): ...
def info(self, channel): ...
def list(self, exclude_archived=None): ...
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None): ...
def invite(self, channel, user): ...
def kick(self, channel, user): ...
def leave(self, channel): ...
def mark(self, channel, ts): ...
def rename(self, channel, name): ...
def replies(self, channel, thread_ts): ...
def archive(self, channel): ...
def unarchive(self, channel): ...
def open(self, channel): ...
def close(self, channel): ...
def set_purpose(self, channel, purpose): ...
def set_topic(self, channel, topic): ...
class Conversations(BaseAPI):
"""Modern unified conversation management."""
def archive(self, channel): ...
def close(self, channel): ...
def create(self, name, user_ids=None, is_private=None): ...
def history(self, channel, cursor=None, inclusive=None, latest=None, oldest=None, limit=None): ...
def info(self, channel, include_locale=None, include_num_members=None): ...
def invite(self, channel, users): ...
def join(self, channel): ...
def kick(self, channel, user): ...
def leave(self, channel): ...
def list(self, cursor=None, exclude_archived=None, types=None, limit=None): ...
def members(self, channel, cursor=None, limit=None): ...
def open(self, channel=None, users=None, return_im=None): ...
def rename(self, channel, name): ...
def replies(self, channel, ts, cursor=None, inclusive=None, latest=None, oldest=None, limit=None): ...
def set_purpose(self, channel, purpose): ...
def set_topic(self, channel, topic): ...
def unarchive(self, channel): ...Install with Tessl CLI
npx tessl i tessl/pypi-slacker