Python API wrapper for Rocket.Chat's REST API, enabling developers to programmatically interact with Rocket.Chat servers for chat automation, bot development, and integration purposes
—
Additional utility functions for directory search and spotlight functionality within Rocket.Chat.
def directory(self, query, **kwargs):
"""
Search the server directory.
Parameters:
- query (dict): Search query parameters
- text (str, optional): Search text
- type (str, optional): Search type ('users', 'channels', 'teams')
- workspace (str, optional): Workspace filter
Returns:
requests.Response: Directory search results
"""
def spotlight(self, query, **kwargs):
"""
Perform spotlight search across users, rooms, and messages.
Parameters:
- query (str): Search query text
Returns:
requests.Response: Spotlight search results
"""# Directory search for users
user_search = rocket.directory(
query={'text': 'john', 'type': 'users'}
)
# Directory search for channels
channel_search = rocket.directory(
query={'text': 'general', 'type': 'channels'}
)
# Spotlight search
results = rocket.spotlight('project meeting')
spotlight_data = results.json()
print(f"Found {len(spotlight_data['users'])} users")
print(f"Found {len(spotlight_data['rooms'])} rooms")Install with Tessl CLI
npx tessl i tessl/pypi-rocketchat-a-p-i