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
—
Server configuration and settings management for Rocket.Chat administration. Provides access to system settings, OAuth configurations, and service configurations.
def settings_get(self, _id, **kwargs):
"""
Get server setting by ID.
Parameters:
- _id (str): Setting ID
Returns:
requests.Response: Setting value and metadata
"""
def settings_update(self, _id, value, **kwargs):
"""
Update server setting.
Parameters:
- _id (str): Setting ID
- value: New setting value
Returns:
requests.Response: Update result
"""
def settings(self, **kwargs):
"""
List all private settings (admin only).
Parameters:
- offset (int, optional): Number of items to skip
- count (int, optional): Number of items to return
Returns:
requests.Response: List of all settings
"""
def settings_public(self, **kwargs):
"""
List all public settings.
Returns:
requests.Response: List of public settings
"""def settings_oauth(self, **kwargs):
"""
List all OAuth services.
Returns:
requests.Response: OAuth service configurations
"""
def settings_addcustomoauth(self, name, **kwargs):
"""
Add a new custom OAuth service.
Parameters:
- name (str): OAuth service name
Returns:
requests.Response: OAuth service creation result
"""
def service_configurations(self, **kwargs):
"""
List all service configurations.
Returns:
requests.Response: Service configurations
"""CommonSettings = {
"Site_Name": "str", # Server name
"Site_Url": "str", # Server URL
"Organization_Name": "str", # Organization name
"Allow_Invalid_SelfSigned_Certs": "bool", # SSL certificate validation
"FileUpload_Enabled": "bool", # File upload enabled
"FileUpload_MaxFileSize": "int", # Max file size in bytes
"Message_MaxAllowedSize": "int", # Max message size
"LDAP_Enable": "bool", # LDAP authentication
"SAML_Custom_Default": "bool", # SAML authentication
"Accounts_Registration_AuthenticationServices_Enabled": "bool", # Registration enabled
"Accounts_AllowAnonymousRead": "bool", # Anonymous read access
"Message_ShowEditedStatus": "bool", # Show edited message status
"Message_ShowDeletedStatus": "bool", # Show deleted message status
"Discussion_enabled": "bool", # Discussion feature enabled
"Threads_enabled": "bool", # Threading enabled
"E2E_Enable": "bool", # End-to-end encryption
"Jitsi_Enabled": "bool", # Jitsi video conferencing
"Webdav_Integration_Enabled": "bool", # WebDAV integration
"AutoTranslate_Enabled": "bool", # Auto-translation feature
"Push_debug": "bool", # Push notification debugging
"Push_enable": "bool", # Push notifications enabled
"API_Enable_Rate_Limiter": "bool", # API rate limiting
"API_Enable_CORS": "bool" # CORS for API
}# Get specific setting
site_name = rocket.settings_get('Site_Name')
print(f"Server name: {site_name.json()['value']}")
# Update setting (admin required)
rocket.settings_update('Site_Name', 'My Rocket.Chat Server')
# Get all public settings
public_settings = rocket.settings_public()
for setting in public_settings.json()['settings']:
print(f"{setting['_id']}: {setting['value']}")
# List OAuth services
oauth_services = rocket.settings_oauth()
print("Available OAuth services:")
for service in oauth_services.json()['services']:
print(f"- {service['name']}")
# Add custom OAuth service
custom_oauth = rocket.settings_addcustomoauth('MyCustomAuth')
# Get service configurations
configs = rocket.service_configurations()
print("Service configurations available")
# Common settings check
settings_to_check = [
'FileUpload_Enabled',
'FileUpload_MaxFileSize',
'Message_MaxAllowedSize',
'Discussion_enabled'
]
for setting_id in settings_to_check:
result = rocket.settings_get(setting_id)
setting_data = result.json()
print(f"{setting_id}: {setting_data['value']} (type: {setting_data['type']})")Install with Tessl CLI
npx tessl i tessl/pypi-rocketchat-a-p-i