0
# Admin Operations
1
2
Enterprise Grid administration including user management, team settings, and policy enforcement.
3
4
## Capabilities
5
6
### User Management
7
8
Manage users across the Enterprise Grid organization.
9
10
```typescript { .api }
11
/**
12
* Invite a user to the workspace
13
* @param options - User invitation parameters
14
* @returns Promise resolving to invitation result
15
*/
16
admin.users.invite(options: AdminUsersInviteArguments): Promise<AdminUsersInviteResponse>;
17
18
/**
19
* List users in the organization
20
* @param options - List parameters
21
* @returns Promise resolving to users list
22
*/
23
admin.users.list(options?: AdminUsersListArguments): Promise<AdminUsersListResponse>;
24
25
/**
26
* Remove a user from the workspace
27
* @param options - User removal parameters
28
* @returns Promise resolving to removal result
29
*/
30
admin.users.remove(options: AdminUsersRemoveArguments): Promise<AdminUsersRemoveResponse>;
31
32
interface AdminUsersInviteArguments {
33
/** Email address of the user to invite */
34
email: string;
35
/** Team ID to invite user to */
36
team_id: string;
37
/** Channel IDs to add user to */
38
channel_ids?: string;
39
/** Set to true to force invitation even if user is already invited */
40
resend?: boolean;
41
/** Custom message to include in invitation */
42
custom_message?: string;
43
/** Set user as guest */
44
is_restricted?: boolean;
45
/** Set user as ultra restricted guest */
46
is_ultra_restricted?: boolean;
47
/** Real name of the user */
48
real_name?: string;
49
}
50
```
51
52
**Usage Examples:**
53
54
```typescript
55
import { WebClient } from "@slack/web-api";
56
57
const web = new WebClient(token);
58
59
// Invite new user
60
const invitation = await web.admin.users.invite({
61
email: 'newuser@company.com',
62
team_id: 'T1234567890',
63
channel_ids: 'C1111111111,C2222222222',
64
real_name: 'John Doe',
65
custom_message: 'Welcome to our Slack workspace!'
66
});
67
68
// List all users in organization
69
const users = await web.admin.users.list({
70
limit: 100
71
});
72
73
console.log(`Organization has ${users.users.length} users`);
74
75
// Remove user from workspace
76
await web.admin.users.remove({
77
team_id: 'T1234567890',
78
user_id: 'U1234567890'
79
});
80
```
81
82
### Team Management
83
84
Create and manage teams within Enterprise Grid.
85
86
```typescript { .api }
87
/**
88
* Create a new team
89
* @param options - Team creation parameters
90
* @returns Promise resolving to new team details
91
*/
92
admin.teams.create(options: AdminTeamsCreateArguments): Promise<AdminTeamsCreateResponse>;
93
94
/**
95
* List teams in the organization
96
* @param options - List parameters
97
* @returns Promise resolving to teams list
98
*/
99
admin.teams.list(options?: AdminTeamsListArguments): Promise<AdminTeamsListResponse>;
100
101
interface AdminTeamsCreateArguments {
102
/** Team domain (subdomain) */
103
team_domain: string;
104
/** Team name */
105
team_name: string;
106
/** Team description */
107
team_description?: string;
108
/** Whether team should be discoverable by domain */
109
team_discoverability?: 'open' | 'invite_only' | 'closed';
110
}
111
```
112
113
**Usage Examples:**
114
115
```typescript
116
// Create new team
117
const newTeam = await web.admin.teams.create({
118
team_domain: 'engineering-team',
119
team_name: 'Engineering Team',
120
team_description: 'Software engineering discussions and coordination',
121
team_discoverability: 'invite_only'
122
});
123
124
console.log('Created team:', newTeam.team.id);
125
126
// List all teams
127
const teams = await web.admin.teams.list();
128
129
for (const team of teams.teams) {
130
console.log(`Team: ${team.name} (${team.id})`);
131
}
132
```
133
134
### Conversation Management
135
136
Administrative control over conversations across the organization.
137
138
```typescript { .api }
139
/**
140
* Create a conversation administratively
141
* @param options - Creation parameters
142
* @returns Promise resolving to conversation details
143
*/
144
admin.conversations.create(options: AdminConversationsCreateArguments): Promise<AdminConversationsCreateResponse>;
145
146
/**
147
* Archive conversations administratively
148
* @param options - Archive parameters
149
* @returns Promise resolving to archive result
150
*/
151
admin.conversations.archive(options: AdminConversationsArchiveArguments): Promise<AdminConversationsArchiveResponse>;
152
153
/**
154
* Search conversations across the organization
155
* @param options - Search parameters
156
* @returns Promise resolving to search results
157
*/
158
admin.conversations.search(options: AdminConversationsSearchArguments): Promise<AdminConversationsSearchResponse>;
159
160
interface AdminConversationsCreateArguments {
161
/** Name of the conversation */
162
name: string;
163
/** Whether the conversation is private */
164
is_private: boolean;
165
/** Team ID where conversation should be created */
166
team_id?: string;
167
/** Description of the conversation */
168
description?: string;
169
/** Whether the conversation is org-wide */
170
org_wide?: boolean;
171
}
172
```
173
174
**Usage Examples:**
175
176
```typescript
177
// Create admin-managed channel
178
const adminChannel = await web.admin.conversations.create({
179
name: 'company-announcements',
180
is_private: false,
181
org_wide: true,
182
description: 'Official company-wide announcements'
183
});
184
185
// Search for conversations
186
const searchResults = await web.admin.conversations.search({
187
query: 'project-alpha',
188
limit: 50
189
});
190
191
console.log(`Found ${searchResults.conversations.length} matching conversations`);
192
```
193
194
### App Management
195
196
Manage applications and their permissions across the organization.
197
198
```typescript { .api }
199
/**
200
* Approve an app installation request
201
* @param options - Approval parameters
202
* @returns Promise resolving to approval result
203
*/
204
admin.apps.approve(options: AdminAppsApproveArguments): Promise<AdminAppsApproveResponse>;
205
206
/**
207
* Restrict an app
208
* @param options - Restriction parameters
209
* @returns Promise resolving to restriction result
210
*/
211
admin.apps.restrict(options: AdminAppsRestrictArguments): Promise<AdminAppsRestrictResponse>;
212
213
/**
214
* List app requests
215
* @param options - List parameters
216
* @returns Promise resolving to requests list
217
*/
218
admin.apps.requests.list(options?: AdminAppsRequestsListArguments): Promise<AdminAppsRequestsListResponse>;
219
220
interface AdminAppsApproveArguments {
221
/** App ID to approve */
222
app_id: string;
223
/** Team ID where app should be approved */
224
team_id?: string;
225
/** Request ID to approve */
226
request_id?: string;
227
}
228
```
229
230
**Usage Examples:**
231
232
```typescript
233
// List pending app requests
234
const appRequests = await web.admin.apps.requests.list({
235
limit: 50
236
});
237
238
console.log(`${appRequests.app_requests.length} pending app requests`);
239
240
// Approve app installation
241
await web.admin.apps.approve({
242
app_id: 'A1234567890',
243
team_id: 'T1234567890'
244
});
245
246
// Restrict app
247
await web.admin.apps.restrict({
248
app_id: 'A1234567890',
249
team_id: 'T1234567890'
250
});
251
```
252
253
### Emoji Management
254
255
Manage custom emoji across the organization.
256
257
```typescript { .api }
258
/**
259
* Add custom emoji
260
* @param options - Emoji addition parameters
261
* @returns Promise resolving to addition result
262
*/
263
admin.emoji.add(options: AdminEmojiAddArguments): Promise<AdminEmojiAddResponse>;
264
265
/**
266
* List custom emoji
267
* @param options - List parameters
268
* @returns Promise resolving to emoji list
269
*/
270
admin.emoji.list(options?: AdminEmojiListArguments): Promise<AdminEmojiListResponse>;
271
272
/**
273
* Remove custom emoji
274
* @param options - Removal parameters
275
* @returns Promise resolving to removal result
276
*/
277
admin.emoji.remove(options: AdminEmojiRemoveArguments): Promise<AdminEmojiRemoveResponse>;
278
279
interface AdminEmojiAddArguments {
280
/** Name of the emoji */
281
name: string;
282
/** Image data for the emoji */
283
url: string;
284
}
285
```
286
287
**Usage Examples:**
288
289
```typescript
290
// Add custom emoji
291
await web.admin.emoji.add({
292
name: 'company-logo',
293
url: 'https://company.com/logo.png'
294
});
295
296
// List all custom emoji
297
const emojiList = await web.admin.emoji.list();
298
299
console.log(`Organization has ${emojiList.emoji.length} custom emoji`);
300
301
// Remove emoji
302
await web.admin.emoji.remove({
303
name: 'old-emoji'
304
});
305
```
306
307
### Workspace Settings
308
309
Manage organization-wide settings and policies.
310
311
```typescript { .api }
312
/**
313
* Set team settings
314
* @param options - Settings parameters
315
* @returns Promise resolving to settings update result
316
*/
317
admin.teams.settings.setDefaultChannels(options: AdminTeamsSettingsSetDefaultChannelsArguments): Promise<AdminTeamsSettingsSetDefaultChannelsResponse>;
318
319
/**
320
* Set team discoverability
321
* @param options - Discoverability parameters
322
* @returns Promise resolving to discoverability update result
323
*/
324
admin.teams.settings.setDiscoverability(options: AdminTeamsSettingsSetDiscoverabilityArguments): Promise<AdminTeamsSettingsSetDiscoverabilityResponse>;
325
326
interface AdminTeamsSettingsSetDefaultChannelsArguments {
327
/** Team ID to set default channels for */
328
team_id: string;
329
/** Channel IDs to set as default */
330
channel_ids: string;
331
}
332
```
333
334
**Usage Examples:**
335
336
```typescript
337
// Set default channels for new team members
338
await web.admin.teams.settings.setDefaultChannels({
339
team_id: 'T1234567890',
340
channel_ids: 'C1111111111,C2222222222,C3333333333'
341
});
342
343
// Set team discoverability
344
await web.admin.teams.settings.setDiscoverability({
345
team_id: 'T1234567890',
346
discoverability: 'invite_only'
347
});
348
```
349
350
### Analytics
351
352
Access organization analytics and usage data.
353
354
```typescript { .api }
355
/**
356
* Get analytics file
357
* @param options - Analytics parameters
358
* @returns Promise resolving to analytics data file
359
*/
360
admin.analytics.getFile(options: AdminAnalyticsGetFileArguments): Promise<AdminAnalyticsGetFileResponse>;
361
362
interface AdminAnalyticsGetFileArguments {
363
/** Type of analytics (e.g., 'member', 'public_channel') */
364
type: string;
365
/** Date for the analytics data (YYYY-MM-DD) */
366
date?: string;
367
/** Metadata only flag */
368
metadata_only?: boolean;
369
}
370
```
371
372
**Usage Examples:**
373
374
```typescript
375
// Get member analytics
376
const memberAnalytics = await web.admin.analytics.getFile({
377
type: 'member',
378
date: '2024-01-15'
379
});
380
381
// Get channel analytics
382
const channelAnalytics = await web.admin.analytics.getFile({
383
type: 'public_channel',
384
date: '2024-01-15'
385
});
386
387
console.log('Analytics file URL:', memberAnalytics.file.url);
388
```
389
390
## Types
391
392
```typescript { .api }
393
interface AdminUsersInviteResponse extends WebAPICallResult {
394
user: {
395
id: string;
396
team_id: string;
397
name: string;
398
email: string;
399
real_name: string;
400
};
401
}
402
403
interface AdminTeamsCreateResponse extends WebAPICallResult {
404
team: {
405
id: string;
406
name: string;
407
domain: string;
408
email_domain: string;
409
icon: {
410
image_default: boolean;
411
image_34: string;
412
image_44: string;
413
image_68: string;
414
image_88: string;
415
image_102: string;
416
image_132: string;
417
image_230: string;
418
};
419
};
420
}
421
422
interface AdminConversationsCreateResponse extends WebAPICallResult {
423
channel_id: string;
424
}
425
426
interface AdminEmojiListResponse extends WebAPICallResult {
427
emoji: {
428
[key: string]: string;
429
};
430
cache_ts: string;
431
categories: Array<{
432
name: string;
433
display_name: string;
434
emoji_names: string[];
435
}>;
436
}
437
```