0
# Advanced Features
1
2
Additional Slack functionality including webhooks, dialogs, presence management, Do Not Disturb settings, reminders, team administration, bot management, and migration utilities.
3
4
## Capabilities
5
6
### Incoming Webhooks
7
8
Send messages using incoming webhooks for simpler integration without full API access.
9
10
```python { .api }
11
def post(self, data):
12
"""
13
Post message via incoming webhook.
14
15
Args:
16
data (dict): Webhook payload with message content and formatting
17
18
Returns:
19
requests.Response: HTTP response from webhook post
20
"""
21
```
22
23
Usage:
24
```python
25
from slacker import IncomingWebhook
26
27
webhook = IncomingWebhook(url='https://hooks.slack.com/services/...')
28
webhook.post({
29
'text': 'Hello from webhook!',
30
'username': 'Bot Name',
31
'icon_emoji': ':robot_face:'
32
})
33
```
34
35
### Interactive Dialogs
36
37
Create and manage interactive dialogs for complex user interactions.
38
39
```python { .api }
40
def open(self, dialog, trigger_id):
41
"""
42
Open an interactive dialog.
43
44
Args:
45
dialog (dict): Dialog definition with elements and metadata
46
trigger_id (str): Trigger ID from interactive component
47
48
Returns:
49
Response: Dialog open confirmation
50
"""
51
```
52
53
### Presence Management
54
55
Advanced presence status management for users.
56
57
```python { .api }
58
def set(self, presence):
59
"""
60
Set user presence status.
61
62
Args:
63
presence (str): Presence status ('auto' or 'away')
64
65
Returns:
66
Response: Presence update confirmation
67
"""
68
```
69
70
Constants:
71
```python { .api }
72
AWAY = 'away'
73
ACTIVE = 'active'
74
TYPES = (AWAY, ACTIVE)
75
```
76
77
### Do Not Disturb
78
79
Manage Do Not Disturb settings and snooze periods.
80
81
```python { .api }
82
def team_info(self, users=None):
83
"""
84
Get DND info for team members.
85
86
Args:
87
users (list of str, optional): User IDs to query
88
89
Returns:
90
Response: DND status for specified users
91
"""
92
93
def set_snooze(self, num_minutes):
94
"""
95
Set DND snooze period.
96
97
Args:
98
num_minutes (int): Minutes to snooze notifications
99
100
Returns:
101
Response: Snooze confirmation
102
"""
103
104
def info(self, user=None):
105
"""
106
Get DND info for user.
107
108
Args:
109
user (str, optional): User ID (current user if None)
110
111
Returns:
112
Response: User's DND status and schedule
113
"""
114
115
def end_dnd(self):
116
"""
117
End DND period.
118
119
Returns:
120
Response: End DND confirmation
121
"""
122
123
def end_snooze(self):
124
"""
125
End DND snooze period.
126
127
Returns:
128
Response: End snooze confirmation
129
"""
130
```
131
132
### Reminders
133
134
Create and manage personal reminders within Slack.
135
136
```python { .api }
137
def add(self, text, time, user=None):
138
"""
139
Add a reminder.
140
141
Args:
142
text (str): Reminder text
143
time (str or int): When to remind (timestamp or relative time)
144
user (str, optional): User to remind (current user if None)
145
146
Returns:
147
Response: Created reminder information
148
"""
149
150
def complete(self, reminder):
151
"""
152
Mark reminder as complete.
153
154
Args:
155
reminder (str): Reminder ID
156
157
Returns:
158
Response: Completion confirmation
159
"""
160
161
def delete(self, reminder):
162
"""
163
Delete a reminder.
164
165
Args:
166
reminder (str): Reminder ID
167
168
Returns:
169
Response: Deletion confirmation
170
"""
171
172
def info(self, reminder):
173
"""
174
Get reminder details.
175
176
Args:
177
reminder (str): Reminder ID
178
179
Returns:
180
Response: Reminder information
181
"""
182
183
def list(self):
184
"""
185
List user's reminders.
186
187
Returns:
188
Response: List of user's reminders
189
"""
190
```
191
192
### Team Administration
193
194
Advanced team management and logging functionality.
195
196
```python { .api }
197
def info(self):
198
"""
199
Get team information.
200
201
Returns:
202
Response: Team details and settings
203
"""
204
205
def access_logs(self, count=None, page=None, before=None):
206
"""
207
Get team access logs.
208
209
Args:
210
count (int, optional): Number of entries per page
211
page (int, optional): Page number
212
before (str, optional): Latest timestamp to include
213
214
Returns:
215
Response: Access log entries
216
"""
217
218
def integration_logs(self, service_id=None, app_id=None, user=None, change_type=None, count=None, page=None):
219
"""
220
Get team integration logs.
221
222
Args:
223
service_id (str, optional): Filter by service ID
224
app_id (str, optional): Filter by app ID
225
user (str, optional): Filter by user
226
change_type (str, optional): Filter by change type
227
count (int, optional): Number of entries per page
228
page (int, optional): Page number
229
230
Returns:
231
Response: Integration log entries
232
"""
233
234
def billable_info(self, user=None):
235
"""
236
Get billable user information.
237
238
Args:
239
user (str, optional): User ID to query
240
241
Returns:
242
Response: Billing information for users
243
"""
244
```
245
246
### Bot Management
247
248
Information about bots in the workspace.
249
250
```python { .api }
251
def info(self, bot=None):
252
"""
253
Get bot information.
254
255
Args:
256
bot (str, optional): Bot ID
257
258
Returns:
259
Response: Bot details and configuration
260
"""
261
```
262
263
### Migration Utilities
264
265
User ID migration utilities for workspace changes.
266
267
```python { .api }
268
def exchange(self, users, to_old=False):
269
"""
270
Exchange user IDs during migration.
271
272
Args:
273
users (list of str): User IDs to exchange
274
to_old (bool): Convert to old format (default: False)
275
276
Returns:
277
Response: Mapped user IDs
278
"""
279
```
280
281
### Identity Provider Groups
282
283
Manage external identity provider groups.
284
285
```python { .api }
286
def list(self, include_users=False):
287
"""
288
List identity provider groups.
289
290
Args:
291
include_users (bool): Include user lists (default: False)
292
293
Returns:
294
Response: IDP groups with metadata
295
"""
296
```
297
298
### App Management
299
300
Manage Slack app installations and permissions.
301
302
```python { .api }
303
def uninstall(self, client_id, client_secret):
304
"""
305
Uninstall a Slack app.
306
307
Args:
308
client_id (str): App client ID
309
client_secret (str): App client secret
310
311
Returns:
312
Response: Uninstall confirmation
313
"""
314
315
def info(self):
316
"""
317
Get app permissions info.
318
319
Returns:
320
Response: Current app permissions and scopes
321
"""
322
323
def request(self, scopes, trigger_id):
324
"""
325
Request additional app permissions.
326
327
Args:
328
scopes (list of str): Requested permission scopes
329
trigger_id (str): Trigger ID from user interaction
330
331
Returns:
332
Response: Permission request confirmation
333
334
Note:
335
WARNING: The source code implementation has a bug in lines 1147-1148
336
where parameter variables are used as dictionary keys instead of
337
string literals, which may cause runtime errors.
338
"""
339
```
340
341
### Direct Messages
342
343
Manage direct message conversations.
344
345
```python { .api }
346
def list(self):
347
"""
348
List direct message conversations.
349
350
Returns:
351
Response: IM channel list
352
"""
353
354
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None, unreads=False):
355
"""
356
Get DM conversation history.
357
358
Args:
359
channel (str): IM channel ID
360
latest (str, optional): Latest message timestamp
361
oldest (str, optional): Oldest message timestamp
362
count (int, optional): Number of messages
363
inclusive (bool, optional): Include boundary messages
364
unreads (bool): Include unread info (default: False)
365
366
Returns:
367
Response: IM message history
368
"""
369
370
def open(self, user):
371
"""
372
Open direct message conversation.
373
374
Args:
375
user (str): User ID to open DM with
376
377
Returns:
378
Response: IM channel information
379
"""
380
381
def close(self, channel):
382
"""
383
Close direct message conversation.
384
385
Args:
386
channel (str): IM channel ID
387
388
Returns:
389
Response: Close confirmation
390
"""
391
392
def replies(self, channel, thread_ts):
393
"""
394
Retrieve replies to a threaded message in direct message.
395
396
Args:
397
channel (str): IM channel ID
398
thread_ts (str): Thread parent message timestamp
399
400
Returns:
401
Response: Thread replies with message details
402
"""
403
404
def mark(self, channel, ts):
405
"""
406
Mark direct message conversation as read up to a certain point.
407
408
Args:
409
channel (str): IM channel ID
410
ts (str): Timestamp to mark as read
411
412
Returns:
413
Response: Mark confirmation
414
"""
415
```
416
417
### Multi-Party Direct Messages
418
419
Manage group direct message conversations.
420
421
```python { .api }
422
def open(self, users):
423
"""
424
Open multi-party direct message.
425
426
Args:
427
users (list of str): User IDs for group DM
428
429
Returns:
430
Response: MPIM channel information
431
"""
432
433
def close(self, channel):
434
"""
435
Close multi-party direct message.
436
437
Args:
438
channel (str): MPIM channel ID
439
440
Returns:
441
Response: Close confirmation
442
"""
443
444
def list(self):
445
"""
446
List multi-party direct messages.
447
448
Returns:
449
Response: MPIM channel list
450
"""
451
452
def history(self, channel, latest=None, oldest=None, inclusive=False, count=None, unreads=False):
453
"""
454
Get MPIM conversation history.
455
456
Args:
457
channel (str): MPIM channel ID
458
latest (str, optional): Latest message timestamp
459
oldest (str, optional): Oldest message timestamp
460
inclusive (bool): Include boundary messages (default: False)
461
count (int, optional): Number of messages
462
unreads (bool): Include unread info (default: False)
463
464
Returns:
465
Response: MPIM message history
466
"""
467
468
def mark(self, channel, ts):
469
"""
470
Mark multi-party direct message as read up to a certain point.
471
472
Args:
473
channel (str): MPIM channel ID
474
ts (str): Timestamp to mark as read
475
476
Returns:
477
Response: Mark confirmation
478
"""
479
480
def replies(self, channel, thread_ts):
481
"""
482
Retrieve replies to a threaded message in multi-party direct message.
483
484
Args:
485
channel (str): MPIM channel ID
486
thread_ts (str): Thread parent message timestamp
487
488
Returns:
489
Response: Thread replies with message details
490
"""
491
```
492
493
## Types
494
495
```python { .api }
496
class IncomingWebhook:
497
"""Incoming webhook message posting."""
498
def __init__(self, url=None, timeout=DEFAULT_TIMEOUT, proxies=None): ...
499
def post(self, data): ...
500
501
class Dialog(BaseAPI):
502
"""Interactive dialog management."""
503
def open(self, dialog, trigger_id): ...
504
505
class Presence(BaseAPI):
506
"""User presence management."""
507
AWAY = 'away'
508
ACTIVE = 'active'
509
TYPES = (AWAY, ACTIVE)
510
def set(self, presence): ...
511
512
class DND(BaseAPI):
513
"""Do Not Disturb management."""
514
def team_info(self, users=None): ...
515
def set_snooze(self, num_minutes): ...
516
def info(self, user=None): ...
517
def end_dnd(self): ...
518
def end_snooze(self): ...
519
520
class Reminders(BaseAPI):
521
"""Reminder management."""
522
def add(self, text, time, user=None): ...
523
def complete(self, reminder): ...
524
def delete(self, reminder): ...
525
def info(self, reminder): ...
526
def list(self): ...
527
528
class Team(BaseAPI):
529
"""Team information and administration."""
530
def info(self): ...
531
def access_logs(self, count=None, page=None, before=None): ...
532
def integration_logs(self, service_id=None, app_id=None, user=None, change_type=None, count=None, page=None): ...
533
def billable_info(self, user=None): ...
534
535
@property
536
def profile(self): ... # Returns TeamProfile instance
537
538
class TeamProfile(BaseAPI):
539
"""Team profile management."""
540
def get(self, visibility=None): ...
541
542
class Bots(BaseAPI):
543
"""Bot information."""
544
def info(self, bot=None): ...
545
546
class Migration(BaseAPI):
547
"""User ID migration utilities."""
548
def exchange(self, users, to_old=False): ...
549
550
class IDPGroups(BaseAPI):
551
"""Identity provider group management."""
552
def list(self, include_users=False): ...
553
554
class Apps(BaseAPI):
555
"""Slack app management."""
556
def uninstall(self, client_id, client_secret): ...
557
558
@property
559
def permissions(self): ... # Returns AppsPermissions instance
560
561
class AppsPermissions(BaseAPI):
562
"""App permission management."""
563
def info(self): ...
564
def request(self, scopes, trigger_id): ...
565
566
class IM(BaseAPI):
567
"""Direct message management."""
568
def list(self): ...
569
def history(self, channel, latest=None, oldest=None, count=None, inclusive=None, unreads=False): ...
570
def replies(self, channel, thread_ts): ...
571
def mark(self, channel, ts): ...
572
def open(self, user): ...
573
def close(self, channel): ...
574
575
class MPIM(BaseAPI):
576
"""Multi-party direct message management."""
577
def open(self, users): ...
578
def close(self, channel): ...
579
def mark(self, channel, ts): ...
580
def list(self): ...
581
def history(self, channel, latest=None, oldest=None, inclusive=False, count=None, unreads=False): ...
582
def replies(self, channel, thread_ts): ...
583
584
class API(BaseAPI):
585
"""General API testing."""
586
def test(self, error=None, **kwargs): ...
587
```