0
# Channel Management
1
2
Create, manage, and interact with public channels, private groups, and conversations using both legacy and modern Slack APIs.
3
4
## Capabilities
5
6
### Channel Operations
7
8
Create and manage public channels within your workspace.
9
10
```python { .api }
11
def create(self, name):
12
"""
13
Create a new public channel.
14
15
Args:
16
name (str): Channel name (without # prefix)
17
18
Returns:
19
Response: Created channel information including channel ID
20
"""
21
22
def info(self, channel):
23
"""
24
Get information about a channel.
25
26
Args:
27
channel (str): Channel ID or name
28
29
Returns:
30
Response: Channel details including members, topic, and purpose
31
"""
32
33
def list(self, exclude_archived=None, exclude_members=None):
34
"""
35
List all channels in workspace.
36
37
Args:
38
exclude_archived (bool, optional): Exclude archived channels
39
exclude_members (bool, optional): Exclude member lists
40
41
Returns:
42
Response: List of channels with metadata
43
"""
44
45
def join(self, name):
46
"""
47
Join an existing channel.
48
49
Args:
50
name (str): Channel name to join
51
52
Returns:
53
Response: Join confirmation and channel info
54
"""
55
56
def leave(self, channel):
57
"""
58
Leave a channel.
59
60
Args:
61
channel (str): Channel ID to leave
62
63
Returns:
64
Response: Leave confirmation
65
"""
66
```
67
68
### Channel History
69
70
Retrieve and manage message history within channels.
71
72
```python { .api }
73
def history(self, channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False):
74
"""
75
Retrieve channel message history.
76
77
Args:
78
channel (str): Channel ID
79
latest (str, optional): Latest message timestamp
80
oldest (str, optional): Oldest message timestamp
81
count (int, optional): Number of messages to return
82
inclusive (bool): Include messages with exact timestamps (default: False)
83
unreads (bool): Include unread count info (default: False)
84
85
Returns:
86
Response: Channel messages and metadata
87
"""
88
89
def mark(self, channel, ts):
90
"""
91
Mark a channel as read up to a certain point.
92
93
Args:
94
channel (str): Channel ID
95
ts (str): Timestamp to mark as read
96
97
Returns:
98
Response: Mark confirmation
99
"""
100
101
def replies(self, channel, thread_ts):
102
"""
103
Retrieve replies to a threaded message in a channel.
104
105
Args:
106
channel (str): Channel ID
107
thread_ts (str): Thread parent message timestamp
108
109
Returns:
110
Response: Thread replies with message details
111
"""
112
```
113
114
### Member Management
115
116
Manage channel membership by inviting and removing users.
117
118
```python { .api }
119
def invite(self, channel, user):
120
"""
121
Invite a user to a channel.
122
123
Args:
124
channel (str): Channel ID
125
user (str): User ID to invite
126
127
Returns:
128
Response: Invite confirmation
129
"""
130
131
def kick(self, channel, user):
132
"""
133
Remove a user from a channel.
134
135
Args:
136
channel (str): Channel ID
137
user (str): User ID to remove
138
139
Returns:
140
Response: Removal confirmation
141
"""
142
```
143
144
### Channel Administration
145
146
Administrative functions for channel management.
147
148
```python { .api }
149
def rename(self, channel, name):
150
"""
151
Rename a channel.
152
153
Args:
154
channel (str): Channel ID
155
name (str): New channel name
156
157
Returns:
158
Response: Rename confirmation with new channel info
159
"""
160
161
def archive(self, channel):
162
"""
163
Archive a channel.
164
165
Args:
166
channel (str): Channel ID to archive
167
168
Returns:
169
Response: Archive confirmation
170
"""
171
172
def unarchive(self, channel):
173
"""
174
Unarchive a channel.
175
176
Args:
177
channel (str): Channel ID to unarchive
178
179
Returns:
180
Response: Unarchive confirmation
181
"""
182
183
def set_purpose(self, channel, purpose):
184
"""
185
Set channel purpose.
186
187
Args:
188
channel (str): Channel ID
189
purpose (str): Channel purpose text
190
191
Returns:
192
Response: Purpose update confirmation
193
"""
194
195
def set_topic(self, channel, topic):
196
"""
197
Set channel topic.
198
199
Args:
200
channel (str): Channel ID
201
topic (str): Channel topic text
202
203
Returns:
204
Response: Topic update confirmation
205
"""
206
```
207
208
### Modern Conversations API
209
210
Unified conversation management using Slack's modern API.
211
212
```python { .api }
213
def create(self, name, user_ids=None, is_private=None):
214
"""
215
Create a new conversation (channel or group).
216
217
Args:
218
name (str): Conversation name
219
user_ids (list of str, optional): Initial user IDs to invite
220
is_private (bool, optional): Create as private conversation
221
222
Returns:
223
Response: Created conversation information
224
"""
225
226
def list(self, cursor=None, exclude_archived=None, types=None, limit=None):
227
"""
228
List conversations with cursor-based pagination.
229
230
Args:
231
cursor (str, optional): Pagination cursor
232
exclude_archived (bool, optional): Exclude archived conversations
233
types (list of str, optional): Conversation types to include
234
limit (int, optional): Maximum conversations per page
235
236
Returns:
237
Response: Conversations list with pagination info
238
"""
239
240
def members(self, channel, cursor=None, limit=None):
241
"""
242
List conversation members.
243
244
Args:
245
channel (str): Conversation ID
246
cursor (str, optional): Pagination cursor
247
limit (int, optional): Maximum members per page
248
249
Returns:
250
Response: Member list with pagination info
251
"""
252
253
def open(self, channel=None, users=None, return_im=None):
254
"""
255
Open a conversation.
256
257
Args:
258
channel (str, optional): Existing conversation ID
259
users (list of str, optional): User IDs for new conversation
260
return_im (bool, optional): Return IM channel if exists
261
262
Returns:
263
Response: Opened conversation information
264
"""
265
```
266
267
### Private Groups
268
269
Manage private group conversations (legacy API).
270
271
```python { .api }
272
def create(self, name):
273
"""
274
Create a private group.
275
276
Args:
277
name (str): Group name
278
279
Returns:
280
Response: Created group information
281
"""
282
283
def create_child(self, channel):
284
"""
285
Create a child private group.
286
287
Args:
288
channel (str): Parent channel ID
289
290
Returns:
291
Response: Created child group information
292
"""
293
294
def open(self, channel):
295
"""
296
Open a private group.
297
298
Args:
299
channel (str): Group ID to open
300
301
Returns:
302
Response: Group open confirmation
303
"""
304
305
def close(self, channel):
306
"""
307
Close a private group.
308
309
Args:
310
channel (str): Group ID to close
311
312
Returns:
313
Response: Group close confirmation
314
"""
315
316
def info(self, channel):
317
"""
318
Get information about a private group.
319
320
Args:
321
channel (str): Group ID
322
323
Returns:
324
Response: Group details including members, topic, and purpose
325
"""
326
327
def list(self, exclude_archived=None):
328
"""
329
List private groups.
330
331
Args:
332
exclude_archived (bool, optional): Exclude archived groups
333
334
Returns:
335
Response: List of groups with metadata
336
"""
337
338
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None):
339
"""
340
Retrieve group message history.
341
342
Args:
343
channel (str): Group ID
344
latest (str, optional): Latest message timestamp
345
oldest (str, optional): Oldest message timestamp
346
count (int, optional): Number of messages to return
347
inclusive (bool, optional): Include messages with exact timestamps
348
349
Returns:
350
Response: Group messages and metadata
351
"""
352
353
def invite(self, channel, user):
354
"""
355
Invite a user to a private group.
356
357
Args:
358
channel (str): Group ID
359
user (str): User ID to invite
360
361
Returns:
362
Response: Invite confirmation
363
"""
364
365
def kick(self, channel, user):
366
"""
367
Remove a user from a private group.
368
369
Args:
370
channel (str): Group ID
371
user (str): User ID to remove
372
373
Returns:
374
Response: Removal confirmation
375
"""
376
377
def leave(self, channel):
378
"""
379
Leave a private group.
380
381
Args:
382
channel (str): Group ID to leave
383
384
Returns:
385
Response: Leave confirmation
386
"""
387
388
def mark(self, channel, ts):
389
"""
390
Mark a private group as read up to a certain point.
391
392
Args:
393
channel (str): Group ID
394
ts (str): Timestamp to mark as read
395
396
Returns:
397
Response: Mark confirmation
398
"""
399
400
def rename(self, channel, name):
401
"""
402
Rename a private group.
403
404
Args:
405
channel (str): Group ID
406
name (str): New group name
407
408
Returns:
409
Response: Rename confirmation with new group info
410
"""
411
412
def replies(self, channel, thread_ts):
413
"""
414
Retrieve replies to a threaded message in a private group.
415
416
Args:
417
channel (str): Group ID
418
thread_ts (str): Thread parent message timestamp
419
420
Returns:
421
Response: Thread replies with message details
422
"""
423
424
def archive(self, channel):
425
"""
426
Archive a private group.
427
428
Args:
429
channel (str): Group ID to archive
430
431
Returns:
432
Response: Archive confirmation
433
"""
434
435
def unarchive(self, channel):
436
"""
437
Unarchive a private group.
438
439
Args:
440
channel (str): Group ID to unarchive
441
442
Returns:
443
Response: Unarchive confirmation
444
"""
445
446
def set_purpose(self, channel, purpose):
447
"""
448
Set private group purpose.
449
450
Args:
451
channel (str): Group ID
452
purpose (str): Group purpose text
453
454
Returns:
455
Response: Purpose update confirmation
456
"""
457
458
def set_topic(self, channel, topic):
459
"""
460
Set private group topic.
461
462
Args:
463
channel (str): Group ID
464
topic (str): Group topic text
465
466
Returns:
467
Response: Topic update confirmation
468
"""
469
```
470
471
## Utility Functions
472
473
```python { .api }
474
def get_channel_id(self, channel_name):
475
"""
476
Get channel ID by name.
477
478
Args:
479
channel_name (str): Channel name to look up
480
481
Returns:
482
str or None: Channel ID if found, None otherwise
483
"""
484
```
485
486
## Types
487
488
```python { .api }
489
class Channels(BaseAPI):
490
"""Public channel management."""
491
def create(self, name): ...
492
def info(self, channel): ...
493
def list(self, exclude_archived=None, exclude_members=None): ...
494
def history(self, channel, latest=None, oldest=None, count=None, inclusive=False, unreads=False): ...
495
def mark(self, channel, ts): ...
496
def join(self, name): ...
497
def leave(self, channel): ...
498
def invite(self, channel, user): ...
499
def kick(self, channel, user): ...
500
def rename(self, channel, name): ...
501
def replies(self, channel, thread_ts): ...
502
def archive(self, channel): ...
503
def unarchive(self, channel): ...
504
def set_purpose(self, channel, purpose): ...
505
def set_topic(self, channel, topic): ...
506
def get_channel_id(self, channel_name): ...
507
508
class Groups(BaseAPI):
509
"""Private group management."""
510
def create(self, name): ...
511
def create_child(self, channel): ...
512
def info(self, channel): ...
513
def list(self, exclude_archived=None): ...
514
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None): ...
515
def invite(self, channel, user): ...
516
def kick(self, channel, user): ...
517
def leave(self, channel): ...
518
def mark(self, channel, ts): ...
519
def rename(self, channel, name): ...
520
def replies(self, channel, thread_ts): ...
521
def archive(self, channel): ...
522
def unarchive(self, channel): ...
523
def open(self, channel): ...
524
def close(self, channel): ...
525
def set_purpose(self, channel, purpose): ...
526
def set_topic(self, channel, topic): ...
527
528
class Conversations(BaseAPI):
529
"""Modern unified conversation management."""
530
def archive(self, channel): ...
531
def close(self, channel): ...
532
def create(self, name, user_ids=None, is_private=None): ...
533
def history(self, channel, cursor=None, inclusive=None, latest=None, oldest=None, limit=None): ...
534
def info(self, channel, include_locale=None, include_num_members=None): ...
535
def invite(self, channel, users): ...
536
def join(self, channel): ...
537
def kick(self, channel, user): ...
538
def leave(self, channel): ...
539
def list(self, cursor=None, exclude_archived=None, types=None, limit=None): ...
540
def members(self, channel, cursor=None, limit=None): ...
541
def open(self, channel=None, users=None, return_im=None): ...
542
def rename(self, channel, name): ...
543
def replies(self, channel, ts, cursor=None, inclusive=None, latest=None, oldest=None, limit=None): ...
544
def set_purpose(self, channel, purpose): ...
545
def set_topic(self, channel, topic): ...
546
def unarchive(self, channel): ...
547
```