CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-slacker

Slack API client providing comprehensive Python interface for messaging, file sharing, user management, and team communication features.

Pending
Overview
Eval results
Files

files.mddocs/

File Operations

Upload, download, manage, and share files within Slack channels and conversations.

Capabilities

File Management

Upload and manage files within your Slack workspace.

def upload(self, file_=None, content=None, filetype=None, filename=None, title=None, initial_comment=None, channels=None, thread_ts=None):
    """
    Upload a file to Slack.
    
    Args:
        file_ (str or file object, optional): File path or file object to upload
        content (str, optional): File content as string (for text files)
        filetype (str, optional): File type identifier
        filename (str, optional): Filename for the upload
        title (str, optional): Title for the file
        initial_comment (str, optional): Initial comment on the file
        channels (list of str, optional): Channels to share file in
        thread_ts (str, optional): Thread timestamp for threaded file sharing
    
    Returns:
        Response: Uploaded file information including file ID and URL
    """

def delete(self, file_):
    """
    Delete a file.
    
    Args:
        file_ (str): File ID to delete
    
    Returns:
        Response: Deletion confirmation
    """

def info(self, file_, count=None, page=None):
    """
    Get information about a file.
    
    Args:
        file_ (str): File ID
        count (int, optional): Number of comments to return
        page (int, optional): Page of comments to return
    
    Returns:
        Response: File information including metadata and comments
    """

def list(self, user=None, ts_from=None, ts_to=None, types=None, count=None, page=None, channel=None):
    """
    List files in workspace.
    
    Args:
        user (str, optional): Filter by user ID
        ts_from (str, optional): Filter files after timestamp
        ts_to (str, optional): Filter files before timestamp
        types (str, optional): Filter by file types (comma-separated)
        count (int, optional): Number of files per page
        page (int, optional): Page number
        channel (str, optional): Filter by channel
    
    Returns:
        Response: List of files with metadata
    """

Usage:

# Upload file from path
slack.files.upload('/path/to/file.txt', channels=['#general'])

# Upload file content directly
slack.files.upload(content='Hello, world!', filename='greeting.txt', channels=['#general'])

# Upload with file object
with open('/path/to/file.pdf', 'rb') as f:
    slack.files.upload(file_=f, title='Important Document', channels=['#documents'])

File Sharing

Manage file sharing and public access.

def shared_public_url(self, file_):
    """
    Create a public URL for a file.
    
    Args:
        file_ (str): File ID
    
    Returns:
        Response: Public URL information
    """

def revoke_public_url(self, file_):
    """
    Revoke public URL access for a file.
    
    Args:
        file_ (str): File ID
    
    Returns:
        Response: Revocation confirmation
    """

File Comments

Add, edit, and manage comments on files.

def add(self, file_, comment):
    """
    Add a comment to a file.
    
    Args:
        file_ (str): File ID
        comment (str): Comment text
    
    Returns:
        Response: Created comment information
    """

def edit(self, file_, id_, comment):
    """
    Edit an existing comment on a file.
    
    Args:
        file_ (str): File ID
        id_ (str): Comment ID
        comment (str): New comment text
    
    Returns:
        Response: Updated comment information
    """

def delete(self, file_, id_):
    """
    Delete a comment from a file.
    
    Args:
        file_ (str): File ID
        id_ (str): Comment ID to delete
    
    Returns:
        Response: Deletion confirmation
    """

Types

class Files(BaseAPI):
    """File operations and management."""
    def list(self, user=None, ts_from=None, ts_to=None, types=None, count=None, page=None, channel=None): ...
    def info(self, file_, count=None, page=None): ...
    def upload(self, file_=None, content=None, filetype=None, filename=None, title=None, initial_comment=None, channels=None, thread_ts=None): ...
    def delete(self, file_): ...
    def revoke_public_url(self, file_): ...
    def shared_public_url(self, file_): ...
    
    @property
    def comments(self): ...  # Returns FilesComments instance

class FilesComments(BaseAPI):
    """File comment management."""
    def add(self, file_, comment): ...
    def delete(self, file_, id_): ...
    def edit(self, file_, id_, comment): ...

Install with Tessl CLI

npx tessl i tessl/pypi-slacker

docs

advanced.md

auth.md

channels.md

chat.md

files.md

index.md

interactive.md

rtm.md

search.md

users.md

tile.json