Skip to main content

RocketChat API

Python API wrapper for the Rocket chat API

Documentation

Travis (.org) PyPI - Downloads PyPI Codecov

Install

pip install rocket-python

Usage

Initialize the client with a username and password or token and user_id. This user must have Admin privs:

from rocketchat.api import RocketChatAPI

api = RocketChatAPI(settings={'username': 'someuser', 'password': 'somepassword',
                              'domain': 'https://myrockethchatdomain.com'})
# or
api = RocketChatAPI(settings={'token': 'sometoken', 'user_id': 'someuserid',
                              'domain': 'https://myrockethchatdomain.com'})
Available Calls
api.send_message('message', 'room_id')

api.get_private_rooms()

api.get_private_room_history('room_id', oldest=date)

api.get_public_rooms()

api.get_room_info('room_id')

api.get_private_room_info('room_id')

api.get_room_history('room_id')

api.create_public_room('room_name', 
                        members=[], 
                        read_only=False)

api.delete_public_room('room_id')

api.get_my_info()

api.get_users()

api.get_user_info('user_id')

api.create_user('email', 
                'name', 
                'password', 
                'username', 
                 active=True, 
                 roles=['user'], 
                 join_default_channels=True, 
                 require_password_change=False, 
                 send_welcome_email=False, 
                 verified=False, 
                 customFields=None)
                
api.delete_user('user_id')

api.upload_file(room_id='room_id',
                file='file',
                description='File description',
                message='Example message')

check /rocketchat/calls/api.py for more.

Running Tests

py.test tests rocketchat
Sending a message

You'll first need to get the _id of the room you want to send a message to. Currently, Rocket can only send messages to public rooms.

api.send_message('Your message', room_id)

Release files for rocket-python 1.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for rocket-python 1.3.4
File Interpreter ABI Platform
rocket_python-1.3.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Release files / rocket_python-1.3.4-py2.py3-none-any.whl

Download URL rocket_python-1.3.4-py2.py3-none-any.whl
Size 22.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5400372dcc02fc6d1090f1408f08384aedfeaa7c4b6f07a51fbbdb63ab448e4e
BLAKE2b-256 checksum
How to use checksums
f1a8da6412023ab9ef761f5a6100708746890e9312e89ac6f511c581ad359420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.0

Release history Release notifications | RSS feed

This release

1.3.4 This release

1 release file

1.3.3

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.20

1 release file

1.2.19

1 release file

1.2.17

1 release file

1.2.15

1 release file

1.2.14

1 release file

1.2.13

1 release file

1.2.12

1 release file

1.2.11

1 release file

1.2.10

1 release file

1.2.8

1 release file

1.2.7

1 release file

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0

2 release files

0.2

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page