def main(): args = parse_arguments() config = yaml.load(open(args.config), Loader=yaml.SafeLoader) with sessions.Session() as session: rocket = RocketChat( user_id=config["user_id"], auth_token=config["auth_token"], server_url=config["server"], session=session, ) channels_params = get_params(args.filter_featured, args.regexp) count = 50 # number of channels per page (default 50) channels_list: List[Dict] = [] channels_json = rocket.channels_list(count=count, **channels_params).json() channels_list.extend(channels_json["channels"]) total = channels_json["total"] print(f"Found {total} channels") for offset in tqdm(range(count, total, count)): channels_json = rocket.channels_list( offset=offset, count=count, **channels_params ).json() channels_list.extend(channels_json["channels"]) channels_df = postprocess(pd.DataFrame(channels_list)) if args.add_owners: print("Adding owners") channels_df = add_owners(channels_df, rocket) channels_df.to_csv(args.output_file, index=False)
class ChatManager(object): def __init__(self, username="", password="", server_url="", ssl_verify=False): self.rocket = RocketChat( user=username, password=password, server_url=server_url, ssl_verify=ssl_verify, ) def create_user(self, user, password): # Create the user's account on RocketChat if not self.rocket: return account = self.rocket.users_create(user.email, user.name, password, user.handle.replace(" ", "_")).json() self.create_team(user.team, account) def create_team(self, team, account): # Create a private team group if options.teams: group = self.has_group(team) if not group: groups = self.rocket.groups_create( team.name.replace(" ", "_").lower()).json() group = groups["group"] self.rocket.groups_invite(group["_id"], account["user"]["_id"]) def has_group(self, team): if not team: return False privaterooms = self.rocket.groups_list().json() if "groups" in privaterooms: for group in privaterooms["groups"]: if group["name"] == team.name.replace(" ", "_").lower(): return group return False def post_message(self, message, channel=None): # Send a global message if not channel: default_channel = self.get_default_channel() if default_channel: channel = "#%s" % default_channel if channel: self.rocket.chat_post_message(channel=channel, text=message) def get_default_channel(self): # Get the default channel channels = self.rocket.channels_list().json() if "channels" in channels: for channel in channels["channels"]: if channel["default"]: return channel["name"] return None
def home(request): rocket = RocketChat(settings.ROCKET_USERNAME, settings.ROCKET_PASSWORD, server_url=settings.SERVER_URL, proxies=settings.PROXY_DICT) # Login the system channels = [] # To record channels' info channel_list = rocket.channels_list().json()["channels"] for channel in channel_list: channels.append( (channel["name"], rocket.channels_history( room_id=channel["_id"]).json()["messages"][::-1])) messages_list = rocket.im_list().json()["ims"] messages_list = [i for i in messages_list if i["msgs"] > 0] message_contents = [] for message in messages_list: message_contents.append( (message["usernames"][1], rocket.im_history( room_id=message["_id"]).json()["messages"][::-1])) me = rocket.me().json() # Information about me like name, username, avatar context = { "messages_list": messages_list, "message_contents": message_contents, "channel_list": channel_list, "me": me, 'channels': channels, } message = request.GET.get('message') # receiving messages in the channels channel = request.GET.get("channel") if message and channel: rocket.chat_post_message(message, channel=channel) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) direct_message = request.GET.get( 'direct') # receiving messages in the direct chatting username = request.GET.get("username") if direct_message and username: print("burası çalıştı mı") rocket.chat_post_message(direct_message, channel=username) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) return render(request, 'home.html', context)
class RocketComm: rocket = None def __init__(self, config): self.user = config['user'] self.password = config['pass'] self.URL = config['type'] + '://' + config['host'] def login(self): self.rocket = RocketChat(self.user, self.password, self.URL) def logout(self): self.rocket.logout() def _retrieve_msgs(self, chn): hist = self.rocket.channels_history(chn, count=10000).json() msgs = hist['messages'] return msgs def retrieve_channel_list(self): ids = [] list = self.rocket.channels_list(count=10000).json() for chn in list["channels"]: id = chn['_id'] ids.append(id) return ids def get_emotes(self, chn): emotes = [] msgs = self._retrieve_msgs(chn) p = re.compile(":\w+?:") #emotes tracker for msg in msgs: rmsg = msg['msg'] emote = p.findall(rmsg) emotes.extend(emote) return set(emotes)
def get_channel_id(channel): tries = 0 while True: tries += 1 try: rocket = RocketChat(BOTNAME, PASSWORD, server_url=URL) except requests.exceptions.ConnectionError as e: log.error("Unable to connect to the RocketChat server: %s", e) except Exception as e: log.error("Unknown error occured: %s", e) else: break interval = tries * RECONNECT_INTERVAL print(f"Reconnecting in {interval} seconds...") time.sleep(interval) channels = rocket.channels_list().json()['channels'] for c in channels: if c['name'] == channel: return c['_id']
"label": "democratie", "backgroundColor": getColor(), "data": messagesDataTsunamy['democraty'] }, { "label": "ecologie", "backgroundColor": getColor(), "data": messagesDataTsunamy['ecology'] }, { "label": "technologie", "backgroundColor": getColor(), "data": messagesDataTsunamy['technology'] }] } while True: channels = rocket.channels_list(offset=index).json() totalChannels = channels['total'] for channel in channels['channels']: dataMess = [] dataUsers = [] pprint(channel['name']) begin = date - monthdelta(12) end = begin + monthdelta(1) tsunamy = getTsunamy(channel) for id in range(0, 12): labels[id] = begin.strftime("%b %Y") begindate = begin.isoformat() enddate = end.isoformat()
class TestChannels(unittest.TestCase): def setUp(self): self.rocket = RocketChat() self.user = '******' self.password = '******' self.email = '*****@*****.**' self.rocket.users_register(email=self.email, name=self.user, password=self.password, username=self.user) self.rocket.channels_add_owner('GENERAL', username=self.user) self.rocket = RocketChat(self.user, self.password) testuser = self.rocket.users_info(username='******').json() if not testuser.get('success'): testuser = self.rocket.users_create('*****@*****.**', 'testuser1', 'password', 'testuser1').json() if not testuser.get('success'): self.fail("can't create test user") self.testuser_id = testuser.get('user').get('_id') def tearDown(self): self.rocket.users_delete(self.testuser_id) def test_channels_list(self): channels_list = self.rocket.channels_list().json() self.assertTrue(channels_list.get('success')) self.assertIn('channels', channels_list) def test_channels_list_joined(self): channels_list_joined = self.rocket.channels_list_joined().json() self.assertTrue(channels_list_joined.get('success')) self.assertIn('channels', channels_list_joined) def test_channels_info(self): channels_info = self.rocket.channels_info(room_id='GENERAL').json() self.assertTrue(channels_info.get('success')) self.assertIn('channel', channels_info) self.assertEqual(channels_info.get('channel').get('_id'), 'GENERAL') channel_name = channels_info.get('channel').get('name') channels_info = self.rocket.channels_info(channel=channel_name).json() self.assertTrue(channels_info.get('success')) self.assertIn('channel', channels_info) self.assertEqual(channels_info.get('channel').get('_id'), 'GENERAL') self.assertEqual( channels_info.get('channel').get('name'), channel_name) with self.assertRaises(RocketMissingParamException): self.rocket.channels_info() def test_channels_history(self): channels_history = self.rocket.channels_history( room_id='GENERAL').json() self.assertTrue(channels_history.get('success')) self.assertIn('messages', channels_history) def test_channels_add_all(self): channels_add_all = self.rocket.channels_add_all('GENERAL').json() self.assertTrue(channels_add_all.get('success')) def test_channels_add_and_remove_moderator(self): me = self.rocket.me().json() channels_add_moderator = self.rocket.channels_add_moderator( 'GENERAL', me.get('_id')).json() self.assertTrue(channels_add_moderator.get('success')) channels_remove_moderator = self.rocket.channels_remove_moderator( 'GENERAL', me.get('_id')).json() self.assertTrue(channels_remove_moderator.get('success')) def test_channels_add_and_remove_owner(self): channels_add_owner = self.rocket.channels_add_owner( 'GENERAL', user_id=self.testuser_id).json() self.assertTrue(channels_add_owner.get('success'), channels_add_owner.get('error')) channels_remove_owner = self.rocket.channels_remove_owner( 'GENERAL', user_id=self.testuser_id).json() self.assertTrue(channels_remove_owner.get('success'), channels_remove_owner.get('error')) with self.assertRaises(RocketMissingParamException): self.rocket.channels_add_owner(room_id='GENERAL') def test_channels_archive_unarchive(self): channels_archive = self.rocket.channels_archive('GENERAL').json() self.assertTrue(channels_archive.get('success')) channels_unarchive = self.rocket.channels_unarchive('GENERAL').json() self.assertTrue(channels_unarchive.get('success')) def test_channels_close_open(self): channels_close = self.rocket.channels_close('GENERAL').json() self.assertTrue(channels_close.get('success')) channels_open = self.rocket.channels_open('GENERAL').json() self.assertTrue(channels_open.get('success')) def test_channels_create_delete(self): name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.assertTrue(channels_create.get('success')) self.assertEqual(name, channels_create.get('channel').get('name')) channels_delete = self.rocket.channels_delete(channel=name).json() self.assertTrue(channels_delete.get('success')) channels_create = self.rocket.channels_create(name).json() self.assertTrue(channels_create.get('success')) room_id = channels_create.get('channel').get('_id') channels_delete = self.rocket.channels_delete(room_id=room_id).json() self.assertTrue(channels_delete.get('success')) with self.assertRaises(RocketMissingParamException): self.rocket.channels_delete() def test_channels_get_integrations(self): channels_get_integrations = self.rocket.channels_get_integrations( room_id='GENERAL').json() self.assertTrue(channels_get_integrations.get('success')) def test_channels_invite(self): channels_invite = self.rocket.channels_invite('GENERAL', self.testuser_id).json() self.assertTrue(channels_invite.get('success')) def test_channels_kick(self): channels_kick = self.rocket.channels_kick('GENERAL', self.testuser_id).json() self.assertTrue(channels_kick.get('success')) def test_channels_leave(self): channels_leave = self.rocket.channels_leave('GENERAL').json() self.assertFalse(channels_leave.get('success')) self.assertEqual(channels_leave.get('errorType'), 'error-you-are-last-owner') name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.rocket.channels_invite( room_id=channels_create.get('channel').get('_id'), user_id=self.testuser_id) self.rocket.channels_add_owner( channels_create.get('channel').get('_id'), user_id=self.testuser_id).json() channels_leave = self.rocket.channels_leave( channels_create.get('channel').get('_id')).json() self.assertTrue(channels_leave.get('success')) def test_channels_rename(self): name = str(uuid.uuid1()) name2 = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() channels_rename = self.rocket.channels_rename( room_id=channels_create.get('channel').get('_id'), name=name2).json() self.assertTrue(channels_rename.get('success')) self.assertEqual(channels_rename.get('channel').get('name'), name2) def test_channels_set_description(self): description = str(uuid.uuid1()) channels_set_description = self.rocket.channels_set_description( 'GENERAL', description).json() self.assertTrue(channels_set_description.get('success')) self.assertEqual(channels_set_description.get('description'), description, 'Description does not match') def test_channels_set_join_code(self): join_code = str(uuid.uuid1()) channels_set_join_code = self.rocket.channels_set_join_code( 'GENERAL', join_code).json() self.assertTrue(channels_set_join_code.get('success')) def test_channels_set_read_only(self): channels_set_read_only = self.rocket.channels_set_read_only( 'GENERAL', True).json() self.assertTrue(channels_set_read_only.get('success')) channels_set_read_only = self.rocket.channels_set_read_only( 'GENERAL', False).json() self.assertTrue(channels_set_read_only.get('success')) def test_channels_set_topic(self): topic = str(uuid.uuid1()) channels_set_topic = self.rocket.channels_set_topic('GENERAL', topic).json() self.assertTrue(channels_set_topic.get('success')) self.assertEqual(channels_set_topic.get('topic'), topic, 'Topic does not match') def test_channels_set_type(self): name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.assertTrue(channels_create.get('success')) channels_set_type = self.rocket.channels_set_type( channels_create.get('channel').get('_id'), 'p').json() self.assertTrue(channels_set_type.get('success')) self.assertTrue(channels_set_type.get('channel').get('t'), 'p') channels_set_type = self.rocket.channels_set_type( channels_create.get('channel').get('_id'), 'c').json() # should fail because this is no more a channel self.assertFalse(channels_set_type.get('success')) def test_channels_set_announcement(self): announcement = str(uuid.uuid1()) channels_set_announcement = self.rocket.channels_set_announcement( 'GENERAL', announcement).json() self.assertTrue(channels_set_announcement.get('success')) self.assertEqual(channels_set_announcement.get('announcement'), announcement, 'Topic does not match') def test_channels_set_custom_fields(self): cf = {'key': 'value'} channels_set_custom_fields = self.rocket.channels_set_custom_fields( 'GENERAL', cf).json() self.assertTrue(channels_set_custom_fields.get('success')) self.assertEqual(cf, channels_set_custom_fields['channel']['customFields']) def test_channels_members(self): channels_members = self.rocket.channels_members( room_id='GENERAL').json() self.assertTrue(channels_members.get('success')) channels_members = self.rocket.channels_members( channel='general').json() self.assertTrue(channels_members.get('success')) with self.assertRaises(RocketMissingParamException): self.rocket.channels_members() def test_channels_roles(self): channels_roles = self.rocket.channels_roles(room_id='GENERAL').json() self.assertTrue(channels_roles.get('success')) self.assertIsNotNone(channels_roles.get('roles')) channels_roles = self.rocket.channels_roles(room_name='general').json() self.assertTrue(channels_roles.get('success')) self.assertIsNotNone(channels_roles.get('roles')) with self.assertRaises(RocketMissingParamException): self.rocket.channels_roles() def test_channels_files(self): channels_files = self.rocket.channels_files(room_id='GENERAL').json() self.assertTrue(channels_files.get('success')) channels_files = self.rocket.channels_files(room_name='general').json() self.assertTrue(channels_files.get('success')) with self.assertRaises(RocketMissingParamException): self.rocket.channels_files() def test_channels_get_all_user_mentions_by_channel(self): channels_get_all_user_mentions_by_channel = self.rocket.channels_get_all_user_mentions_by_channel( room_id='GENERAL').json() self.assertTrue( channels_get_all_user_mentions_by_channel.get('success'))
from rocketchat_API.rocketchat import RocketChat import csv import collections import re from pprint import pprint from nltk.tag import StanfordNERTagger channel_id = 'po5DghjugqfxwLahN' #Channel ID for gsoc2018 user = '' #Insert username here password = '' #Insert password here url = 'http://www.clips.uantwerpen.be:3001/' rocket = RocketChat(user, password, server_url=url) #Storing all usernames from the channel in unames channel_data = (rocket.channels_list().json()) for data in channel_data['channels']: if (data['_id'] == channel_id): unames = (data['usernames']) #print(unames) #Pulling all messages from the start of session in 1st March 2018 15:30 IST data = rocket.channels_history(channel_id, oldest='2018-03-01T10:02:30.156Z', count=2000).json() count = 0 datalist = [] for msgs in data['messages']: if (msgs['msg'] not in unames): #Not considering channel join messages count += 1 datalist.append(msgs['msg'])
class TestChannels(unittest.TestCase): def setUp(self): self.rocket = RocketChat() self.user = '******' self.password = '******' self.email = '*****@*****.**' self.rocket.users_register(email=self.email, name=self.user, password=self.password, username=self.user) self.rocket.channels_add_owner('GENERAL', username=self.user) self.rocket = RocketChat(self.user, self.password) self.testuser = self.rocket.users_create('*****@*****.**', 'testuser1', 'password', 'testuser1').json() if not self.testuser.get('success'): user_id = self.rocket.users_info( username='******').json().get('user').get('_id') self.rocket.users_delete(user_id) self.testuser = self.rocket.users_create('*****@*****.**', 'testuser1', 'password', 'testuser1').json() def tearDown(self): self.rocket.users_delete(self.testuser.get('user').get('_id')) def test_channels_list(self): channels_list = self.rocket.channels_list().json() self.assertTrue(channels_list.get('success')) self.assertIn('channels', channels_list) def test_channels_list_joined(self): channels_list_joined = self.rocket.channels_list_joined().json() self.assertTrue(channels_list_joined.get('success')) self.assertIn('channels', channels_list_joined) def test_channels_info(self): channels_info = self.rocket.channels_info(room_id='GENERAL').json() self.assertTrue(channels_info.get('success')) self.assertIn('channel', channels_info) self.assertEqual(channels_info.get('channel').get('_id'), 'GENERAL') def test_channels_history(self): channels_history = self.rocket.channels_history( room_id='GENERAL').json() self.assertTrue(channels_history.get('success')) self.assertIn('messages', channels_history) def test_channels_add_all(self): channels_add_all = self.rocket.channels_add_all('GENERAL').json() self.assertTrue(channels_add_all.get('success')) def test_channels_add_and_remove_moderator(self): me = self.rocket.me().json() channels_add_moderator = self.rocket.channels_add_moderator( 'GENERAL', me.get('_id')).json() self.assertTrue(channels_add_moderator.get('success')) channels_remove_moderator = self.rocket.channels_remove_moderator( 'GENERAL', me.get('_id')).json() self.assertTrue(channels_remove_moderator.get('success')) def test_channels_add_and_remove_owner(self): channels_add_owner = self.rocket.channels_add_owner( 'GENERAL', user_id=self.testuser.get('user').get('_id')).json() self.assertTrue(channels_add_owner.get('success'), channels_add_owner.get('error')) channels_remove_owner = self.rocket.channels_remove_owner( 'GENERAL', user_id=self.testuser.get('user').get('_id')).json() self.assertTrue(channels_remove_owner.get('success'), channels_remove_owner.get('error')) def test_channels_archive_unarchive(self): channels_archive = self.rocket.channels_archive('GENERAL').json() self.assertTrue(channels_archive.get('success')) channels_unarchive = self.rocket.channels_unarchive('GENERAL').json() self.assertTrue(channels_unarchive.get('success')) def test_channels_close_open(self): channels_close = self.rocket.channels_close('GENERAL').json() self.assertTrue(channels_close.get('success')) channels_open = self.rocket.channels_open('GENERAL').json() self.assertTrue(channels_open.get('success')) def test_channels_create(self): name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.assertTrue(channels_create.get('success')) self.assertEqual(name, channels_create.get('channel').get('name')) def test_channels_get_integrations(self): channels_get_integrations = self.rocket.channels_get_integrations( room_id='GENERAL').json() self.assertTrue(channels_get_integrations.get('success')) def test_channels_invite(self): channels_invite = self.rocket.channels_invite( 'GENERAL', self.testuser.get('user').get('_id')).json() self.assertTrue(channels_invite.get('success')) self.assertIn( self.testuser.get('user').get('username'), channels_invite.get('channel').get('usernames')) def test_channels_kick(self): channels_kick = self.rocket.channels_kick( 'GENERAL', self.testuser.get('user').get('_id')).json() self.assertTrue(channels_kick.get('success')) self.assertNotIn( self.testuser.get('user').get('username'), channels_kick.get('channel').get('usernames')) def test_channels_leave(self): channels_leave = self.rocket.channels_leave('GENERAL').json() self.assertFalse(channels_leave.get('success')) self.assertEqual(channels_leave.get('errorType'), 'error-you-are-last-owner') name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.rocket.channels_invite( room_id=channels_create.get('channel').get('_id'), user_id=self.testuser.get('user').get('_id')) self.rocket.channels_add_owner( channels_create.get('channel').get('_id'), user_id=self.testuser.get('user').get('_id')).json() channels_leave = self.rocket.channels_leave( channels_create.get('channel').get('_id')).json() self.assertTrue(channels_leave.get('success')) def test_channels_rename(self): name = str(uuid.uuid1()) name2 = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() channels_rename = self.rocket.channels_rename( room_id=channels_create.get('channel').get('_id'), name=name2).json() self.assertTrue(channels_rename.get('success')) self.assertEqual(channels_rename.get('channel').get('name'), name2) def test_channels_set_description(self): description = str(uuid.uuid1()) channels_set_description = self.rocket.channels_set_description( 'GENERAL', description).json() self.assertTrue(channels_set_description.get('success')) self.assertEqual(channels_set_description.get('description'), description, 'Description does not match') def test_channels_set_join_code(self): join_code = str(uuid.uuid1()) channels_set_join_code = self.rocket.channels_set_join_code( 'GENERAL', join_code).json() self.assertTrue(channels_set_join_code.get('success')) def test_channels_set_read_only(self): channels_set_read_only = self.rocket.channels_set_read_only( 'GENERAL', True).json() self.assertTrue(channels_set_read_only.get('success')) channels_set_read_only = self.rocket.channels_set_read_only( 'GENERAL', False).json() self.assertTrue(channels_set_read_only.get('success')) def test_channels_set_topic(self): topic = str(uuid.uuid1()) channels_set_topic = self.rocket.channels_set_topic('GENERAL', topic).json() self.assertTrue(channels_set_topic.get('success')) self.assertEqual(channels_set_topic.get('topic'), topic, 'Topic does not match') def test_channels_set_type(self): name = str(uuid.uuid1()) channels_create = self.rocket.channels_create(name).json() self.assertTrue(channels_create.get('success')) channels_set_type = self.rocket.channels_set_type( channels_create.get('channel').get('_id'), 'p').json() self.assertTrue(channels_set_type.get('success')) self.assertTrue(channels_set_type.get('channel').get('t'), 'p') channels_set_type = self.rocket.channels_set_type( channels_create.get('channel').get('_id'), 'c').json() self.assertFalse(channels_set_type.get( 'success')) # should fail because this is no more a channel
def sendMessage(mes,cha="integration_test"): rocket = RocketChat('aw5p', '@lexis1437', server_url='https://chat.newegg.org') pprint(rocket.me().json()) pprint(rocket.channels_list().json()) pprint(rocket.chat_post_message(mes, channel=cha, alias='AlertBot').json())
except json.JSONDecodeError as e: print("History file is corrupted! Please remove it or fix it.") sys.exit(4) RATE_LIMIT = CONFIG['rate_limit_ms'] / 1000 HEADERS['X-Auth-Token'] = CONFIG['auth_token'] HEADERS['X-User-Id'] = CONFIG['user_id'] with sessions.Session() as session: print("Connecting to rocket.chat instance...") print("Rate limiter is set to {} seconds".format(RATE_LIMIT)) ROCKET = RocketChat(user_id=CONFIG['user_id'], auth_token=CONFIG['auth_token'], server_url=CONFIG['server'], session=session) CHANNELS = ROCKET.channels_list().json()['channels'] time.sleep(RATE_LIMIT) for channel in CONFIG['channels']: print("Dumping channel {}...".format(channel['name'])) channel_id = get_channel_id(channel['name']) if channel_id is None: print("Channel {} not found!".format(channel['name'])) continue if not os.path.exists(channel['directory']): os.makedirs(channel['directory']) if not os.path.isdir(channel['directory']): print( "Directory specified for channel {} ({}) is not a directory!"
import datetime from rocketchat_API.rocketchat import RocketChat from sendmail.utils import get_config config = get_config() rocket_user = config['rocket_chat']['user'] rocket_pass = config['rocket_chat']['pass'] server_url = config['rocket_chat']['server_url'] rocket = RocketChat(rocket_user, rocket_pass, server_url=server_url) channels = rocket.channels_list().json()['channels'] room_id_map = {} for channel in channels: room_id_map[channel['name']] = channel['_id'] def get_sql(room_name): room_id = room_id_map[room_name] messages = rocket.channels_history(room_id=room_id, count=20).json()['messages'] messages = list(filter(lambda msg: 't' not in msg, messages)) index = next(i for i, m in enumerate(messages) if is_separate(m)) if index == 0: return None messages = messages[:index] return build_sql(messages) def add_separate_message(room_name, mail_version): room_id = room_id_map[room_name]
from pprint import pprint from rocketchat_API.rocketchat import RocketChat rocket = RocketChat('StrangerCalling', 'user password', server_url='http://192.168.86.120:3000') pprint(rocket.me().json()) pprint(rocket.channels_list().json()) pprint( rocket.chat_post_message('good news everyone!', channel='GENERAL').json()) pprint(rocket.channels_history('GENERAL', count=5).json()) #Code from https://pypi.org/project/rocketchat-API/