0
# User Management
1
2
Manage users, user profiles, presence status, and user groups within your Slack workspace.
3
4
## Capabilities
5
6
### User Information
7
8
Retrieve and manage user information and profiles.
9
10
```python { .api }
11
def info(self, user, include_locale=False):
12
"""
13
Get information about a user.
14
15
Args:
16
user (str): User ID
17
include_locale (bool): Include user locale info (default: False)
18
19
Returns:
20
Response: User information including profile, status, and permissions
21
"""
22
23
def list(self, presence=False):
24
"""
25
List all users in workspace.
26
27
Args:
28
presence (bool): Include presence information (default: False)
29
30
Returns:
31
Response: List of workspace users with profiles
32
"""
33
34
def identity(self):
35
"""
36
Get identity information for the current user.
37
38
Returns:
39
Response: Current user's identity and team information
40
"""
41
```
42
43
### User Activity
44
45
Manage user activity status and presence.
46
47
```python { .api }
48
def set_active(self):
49
"""
50
Mark the current user as active.
51
52
Returns:
53
Response: Activity status confirmation
54
"""
55
56
def get_presence(self, user):
57
"""
58
Get presence information for a user.
59
60
Args:
61
user (str): User ID
62
63
Returns:
64
Response: User presence status and activity
65
"""
66
67
def set_presence(self, presence):
68
"""
69
Set presence status for the current user.
70
71
Args:
72
presence (str): Presence status ('auto' or 'away')
73
74
Returns:
75
Response: Presence update confirmation
76
"""
77
```
78
79
### User Profile Management
80
81
Manage user profile information and settings.
82
83
```python { .api }
84
def get(self, user=None, include_labels=False):
85
"""
86
Get user profile information.
87
88
Args:
89
user (str, optional): User ID (current user if None)
90
include_labels (bool): Include field labels (default: False)
91
92
Returns:
93
Response: User profile with fields and values
94
"""
95
96
def set(self, user=None, profile=None, name=None, value=None):
97
"""
98
Set user profile information.
99
100
Args:
101
user (str, optional): User ID (current user if None)
102
profile (dict, optional): Complete profile object
103
name (str, optional): Field name to update
104
value (str, optional): Field value to set
105
106
Returns:
107
Response: Profile update confirmation
108
"""
109
```
110
111
### User Administration
112
113
Administrative functions for user management.
114
115
```python { .api }
116
def invite(self, email, channels=None, first_name=None, last_name=None, resend=True):
117
"""
118
Invite a new user to the workspace.
119
120
Args:
121
email (str): Email address to invite
122
channels (str, optional): Comma-separated channel IDs
123
first_name (str, optional): First name
124
last_name (str, optional): Last name
125
resend (bool): Resend invitation if already sent (default: True)
126
127
Returns:
128
Response: Invitation confirmation
129
"""
130
```
131
132
### User Groups
133
134
Create and manage user groups for organization and permissions.
135
136
```python { .api }
137
def list(self, include_disabled=None, include_count=None, include_users=None):
138
"""
139
List user groups.
140
141
Args:
142
include_disabled (bool, optional): Include disabled groups
143
include_count (bool, optional): Include member counts
144
include_users (bool, optional): Include user lists
145
146
Returns:
147
Response: User groups with metadata
148
"""
149
150
def create(self, name, handle=None, description=None, channels=None, include_count=None):
151
"""
152
Create a new user group.
153
154
Args:
155
name (str): Group name
156
handle (str, optional): Group handle (mention name)
157
description (str, optional): Group description
158
channels (list of str, optional): Default channels for group
159
include_count (bool, optional): Include member count in response
160
161
Returns:
162
Response: Created group information
163
"""
164
165
def update(self, usergroup, name=None, handle=None, description=None, channels=None, include_count=None):
166
"""
167
Update user group information.
168
169
Args:
170
usergroup (str): User group ID
171
name (str, optional): New group name
172
handle (str, optional): New group handle
173
description (str, optional): New group description
174
channels (list of str, optional): New default channels
175
include_count (bool, optional): Include member count in response
176
177
Returns:
178
Response: Updated group information
179
"""
180
181
def disable(self, usergroup, include_count=None):
182
"""
183
Disable a user group.
184
185
Args:
186
usergroup (str): User group ID
187
include_count (bool, optional): Include member count in response
188
189
Returns:
190
Response: Disable confirmation
191
"""
192
193
def enable(self, usergroup, include_count=None):
194
"""
195
Enable a user group.
196
197
Args:
198
usergroup (str): User group ID
199
include_count (bool, optional): Include member count in response
200
201
Returns:
202
Response: Enable confirmation
203
"""
204
```
205
206
### User Group Membership
207
208
Manage user group membership.
209
210
```python { .api }
211
def list(self, usergroup, include_disabled=None):
212
"""
213
List users in a user group.
214
215
Args:
216
usergroup (str): User group ID
217
include_disabled (bool, optional): Include disabled users
218
219
Returns:
220
Response: List of users in the group
221
"""
222
223
def update(self, usergroup, users, include_count=None):
224
"""
225
Update user group membership.
226
227
Args:
228
usergroup (str): User group ID
229
users (list of str): User IDs to set as members
230
include_count (bool, optional): Include member count in response
231
232
Returns:
233
Response: Updated membership information
234
"""
235
```
236
237
## Utility Functions
238
239
```python { .api }
240
def get_user_id(self, user_name):
241
"""
242
Get user ID by username.
243
244
Args:
245
user_name (str): Username to look up
246
247
Returns:
248
str or None: User ID if found, None otherwise
249
"""
250
```
251
252
## Types
253
254
```python { .api }
255
class Users(BaseAPI):
256
"""User management and information."""
257
def info(self, user, include_locale=False): ...
258
def list(self, presence=False): ...
259
def identity(self): ...
260
def set_active(self): ...
261
def get_presence(self, user): ...
262
def set_presence(self, presence): ...
263
def get_user_id(self, user_name): ...
264
265
@property
266
def profile(self): ... # Returns UsersProfile instance
267
268
@property
269
def admin(self): ... # Returns UsersAdmin instance
270
271
class UsersProfile(BaseAPI):
272
"""User profile management."""
273
def get(self, user=None, include_labels=False): ...
274
def set(self, user=None, profile=None, name=None, value=None): ...
275
276
class UsersAdmin(BaseAPI):
277
"""User administration functions."""
278
def invite(self, email, channels=None, first_name=None, last_name=None, resend=True): ...
279
280
class UserGroups(BaseAPI):
281
"""User group management."""
282
def list(self, include_disabled=None, include_count=None, include_users=None): ...
283
def create(self, name, handle=None, description=None, channels=None, include_count=None): ...
284
def update(self, usergroup, name=None, handle=None, description=None, channels=None, include_count=None): ...
285
def disable(self, usergroup, include_count=None): ...
286
def enable(self, usergroup, include_count=None): ...
287
288
@property
289
def users(self): ... # Returns UserGroupsUsers instance
290
291
class UserGroupsUsers(BaseAPI):
292
"""User group membership management."""
293
def list(self, usergroup, include_disabled=None): ...
294
def update(self, usergroup, users, include_count=None): ...
295
```