or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

administration.mdassets.mdchannels.mdchat.mddirect-messages.mdgroups.mdindex.mdintegrations.mdlivechat.mdmiscellaneous.mdpermissions.mdroles.mdrooms.mdsettings.mdstatistics.mdsubscriptions.mdteams.mdusers.md

chat.mddocs/

0

# Chat Operations

1

2

Core messaging functionality for sending, managing, and interacting with messages in Rocket.Chat. Provides comprehensive support for message lifecycle, reactions, threading, and advanced message features.

3

4

## Capabilities

5

6

### Message Sending

7

8

Send messages to channels, groups, and direct messages with various formatting options and attachments.

9

10

```python { .api }

11

def chat_post_message(self, text, room_id=None, channel=None, **kwargs):

12

"""

13

Send a message to a room.

14

15

Parameters:

16

- text (str): Message text content

17

- room_id (str, optional): Room ID to send message to

18

- channel (str, optional): Channel name to send message to

19

- alias (str, optional): Display name override

20

- emoji (str, optional): Emoji for avatar

21

- avatar (str, optional): Avatar URL

22

- attachments (list, optional): Message attachments

23

- parseUrls (bool, optional): Parse URLs in message

24

- bot (dict, optional): Bot information

25

- groupable (bool, optional): Allow message grouping

26

- customFields (dict, optional): Custom message fields

27

28

Returns:

29

requests.Response: Message sending result

30

"""

31

32

def chat_send_message(self, message):

33

"""

34

Send a message object (requires message.rid).

35

36

Parameters:

37

- message (dict): Complete message object with rid

38

39

Returns:

40

requests.Response: Message sending result

41

"""

42

```

43

44

### Message Retrieval and Information

45

46

Get message details, history, and metadata.

47

48

```python { .api }

49

def chat_get_message(self, msg_id, **kwargs):

50

"""

51

Get a message by ID.

52

53

Parameters:

54

- msg_id (str): Message ID

55

56

Returns:

57

requests.Response: Message details

58

"""

59

60

def chat_get_starred_messages(self, room_id, **kwargs):

61

"""

62

Get starred messages in a room.

63

64

Parameters:

65

- room_id (str): Room ID

66

- offset (int, optional): Number of items to skip

67

- count (int, optional): Number of items to return

68

69

Returns:

70

requests.Response: List of starred messages

71

"""

72

73

def chat_get_mentioned_messages(self, room_id, **kwargs):

74

"""

75

Get messages where user is mentioned.

76

77

Parameters:

78

- room_id (str): Room ID

79

- offset (int, optional): Number of items to skip

80

- count (int, optional): Number of items to return

81

82

Returns:

83

requests.Response: List of mentioned messages

84

"""

85

86

def chat_get_message_read_receipts(self, message_id, **kwargs):

87

"""

88

Get message read receipts.

89

90

Parameters:

91

- message_id (str): Message ID

92

93

Returns:

94

requests.Response: Read receipt information

95

"""

96

```

97

98

### Message Management

99

100

Edit, delete, and manage existing messages.

101

102

```python { .api }

103

def chat_update(self, room_id, msg_id, text, **kwargs):

104

"""

105

Update/edit a message.

106

107

Parameters:

108

- room_id (str): Room ID containing the message

109

- msg_id (str): Message ID to update

110

- text (str): New message text

111

- attachments (list, optional): Updated attachments

112

- parseUrls (bool, optional): Parse URLs in updated message

113

114

Returns:

115

requests.Response: Update result

116

"""

117

118

def chat_delete(self, room_id, msg_id, **kwargs):

119

"""

120

Delete a message.

121

122

Parameters:

123

- room_id (str): Room ID containing the message

124

- msg_id (str): Message ID to delete

125

- asUser (bool, optional): Delete as user vs system

126

127

Returns:

128

requests.Response: Deletion result

129

"""

130

```

131

132

### Message Interactions

133

134

React to messages, pin, star, and manage message interactions.

135

136

```python { .api }

137

def chat_react(self, msg_id, emoji="smile", **kwargs):

138

"""

139

Add or remove reaction to a message.

140

141

Parameters:

142

- msg_id (str): Message ID

143

- emoji (str): Emoji reaction (default: "smile")

144

- shouldReact (bool, optional): Add (true) or remove (false) reaction

145

146

Returns:

147

requests.Response: Reaction result

148

"""

149

150

def chat_pin_message(self, msg_id, **kwargs):

151

"""

152

Pin a message.

153

154

Parameters:

155

- msg_id (str): Message ID to pin

156

157

Returns:

158

requests.Response: Pin result

159

"""

160

161

def chat_unpin_message(self, msg_id, **kwargs):

162

"""

163

Unpin a message.

164

165

Parameters:

166

- msg_id (str): Message ID to unpin

167

168

Returns:

169

requests.Response: Unpin result

170

"""

171

172

def chat_star_message(self, msg_id, **kwargs):

173

"""

174

Star a message.

175

176

Parameters:

177

- msg_id (str): Message ID to star

178

179

Returns:

180

requests.Response: Star result

181

"""

182

183

def chat_unstar_message(self, msg_id, **kwargs):

184

"""

185

Unstar a message.

186

187

Parameters:

188

- msg_id (str): Message ID to unstar

189

190

Returns:

191

requests.Response: Unstar result

192

"""

193

```

194

195

### Message Search and Discovery

196

197

Search for messages and content within rooms.

198

199

```python { .api }

200

def chat_search(self, room_id, search_text, **kwargs):

201

"""

202

Search messages in a room.

203

204

Parameters:

205

- room_id (str): Room ID to search in

206

- search_text (str): Text to search for

207

- regex (bool, optional): Use regex search

208

- caseSensitive (bool, optional): Case sensitive search

209

- count (int, optional): Number of results to return

210

- offset (int, optional): Number of results to skip

211

212

Returns:

213

requests.Response: Search results

214

"""

215

```

216

217

### Thread Management

218

219

Manage message threads and threaded conversations.

220

221

```python { .api }

222

def chat_get_thread_messages(self, thread_msg_id, **kwargs):

223

"""

224

Get messages in a thread.

225

226

Parameters:

227

- thread_msg_id (str): Thread parent message ID

228

- offset (int, optional): Number of items to skip

229

- count (int, optional): Number of items to return

230

- sort (dict, optional): Sort criteria

231

- query (dict, optional): Query filters

232

233

Returns:

234

requests.Response: Thread messages

235

"""

236

237

def chat_follow_message(self, mid, **kwargs):

238

"""

239

Follow a message thread.

240

241

Parameters:

242

- mid (str): Message ID to follow

243

244

Returns:

245

requests.Response: Follow result

246

"""

247

```

248

249

### Message Reporting and Moderation

250

251

Report messages and handle moderation actions.

252

253

```python { .api }

254

def chat_report_message(self, message_id, description, **kwargs):

255

"""

256

Report a message for moderation.

257

258

Parameters:

259

- message_id (str): Message ID to report

260

- description (str): Report description/reason

261

262

Returns:

263

requests.Response: Report submission result

264

"""

265

```

266

267

## Message Format Types

268

269

### Basic Message Structure

270

271

```python { .api }

272

MessageObject = {

273

"_id": "str", # Message ID

274

"rid": "str", # Room ID

275

"msg": "str", # Message text

276

"ts": "datetime", # Timestamp

277

"u": { # User object

278

"_id": "str",

279

"username": "str",

280

"name": "str"

281

},

282

"mentions": ["UserObject"], # Mentioned users

283

"channels": ["ChannelObject"], # Mentioned channels

284

"_updatedAt": "datetime",

285

"editedAt": "datetime", # If edited

286

"editedBy": "UserObject", # Editor info

287

"urls": ["UrlObject"], # Parsed URLs

288

"attachments": ["AttachmentObject"], # File attachments

289

"reactions": "dict", # Emoji reactions

290

"starred": ["UserObject"], # Users who starred

291

"pinned": "bool", # Pin status

292

"pinnedAt": "datetime", # Pin timestamp

293

"pinnedBy": "UserObject" # Who pinned

294

}

295

```

296

297

### Attachment Structure

298

299

```python { .api }

300

AttachmentObject = {

301

"title": "str",

302

"title_link": "str",

303

"text": "str",

304

"color": "str",

305

"thumb_url": "str",

306

"image_url": "str",

307

"author_name": "str",

308

"author_link": "str",

309

"author_icon": "str",

310

"fields": [{

311

"title": "str",

312

"value": "str",

313

"short": "bool"

314

}],

315

"ts": "datetime"

316

}

317

```

318

319

## Usage Examples

320

321

### Sending Messages with Formatting

322

323

```python

324

# Send a simple message

325

response = rocket.chat_post_message(

326

text="Hello, World!",

327

channel="general"

328

)

329

330

# Send a message with formatting and attachments

331

response = rocket.chat_post_message(

332

text="Important update:",

333

room_id="ROOM_ID",

334

alias="System Bot",

335

emoji=":bell:",

336

attachments=[{

337

"title": "Server Status",

338

"text": "All systems operational",

339

"color": "good",

340

"fields": [{

341

"title": "Uptime",

342

"value": "99.9%",

343

"short": True

344

}]

345

}]

346

)

347

```

348

349

### Message Management Workflow

350

351

```python

352

# Send a message

353

response = rocket.chat_post_message(text="Original message", channel="general")

354

msg_id = response.json()['message']['_id']

355

room_id = response.json()['message']['rid']

356

357

# Edit the message

358

rocket.chat_update(room_id, msg_id, "Updated message content")

359

360

# Add reaction

361

rocket.chat_react(msg_id, "thumbsup")

362

363

# Pin the message

364

rocket.chat_pin_message(msg_id)

365

366

# Star the message

367

rocket.chat_star_message(msg_id)

368

```

369

370

### Message Search and Discovery

371

372

```python

373

# Search for messages containing specific text

374

results = rocket.chat_search(

375

room_id="ROOM_ID",

376

search_text="important announcement",

377

count=10

378

)

379

380

# Get messages where user is mentioned

381

mentions = rocket.chat_get_mentioned_messages(

382

room_id="ROOM_ID",

383

count=20

384

)

385

386

# Get starred messages

387

starred = rocket.chat_get_starred_messages(

388

room_id="ROOM_ID"

389

)

390

```

391

392

### Thread Management

393

394

```python

395

# Get thread messages

396

thread_messages = rocket.chat_get_thread_messages(

397

thread_msg_id="PARENT_MESSAGE_ID",

398

count=50

399

)

400

401

# Follow a thread for notifications

402

rocket.chat_follow_message("PARENT_MESSAGE_ID")

403

```