0
# Event System
1
2
Slack's Events API provides real-time notifications about activities in a workspace. This module defines TypeScript interfaces for all event types, enabling type-safe event handling in Slack applications.
3
4
## Capabilities
5
6
### Master Event Union
7
8
The main discriminated union containing all Slack event types.
9
10
```typescript { .api }
11
type SlackEvent = AppDeletedEvent | AppHomeOpenedEvent | AppInstalledEvent | AppMentionEvent | AppRateLimitedEvent | AppRequestedEvent | AppUninstalledEvent | AppUninstalledTeamEvent | AssistantThreadContextChangedEvent | AssistantThreadStartedEvent | CallRejectedEvent | ChannelArchiveEvent | ChannelCreatedEvent | ChannelDeletedEvent | ChannelHistoryChangedEvent | ChannelIDChangedEvent | ChannelLeftEvent | ChannelRenameEvent | ChannelSharedEvent | ChannelUnarchiveEvent | ChannelUnsharedEvent | DNDUpdatedEvent | DNDUpdatedUserEvent | EmailDomainChangedEvent | EmojiChangedEvent | FileChangeEvent | FileCommentDeletedEvent | FileCreatedEvent | FileDeletedEvent | FilePublicEvent | FileSharedEvent | FileUnsharedEvent | FunctionExecutedEvent | GridMigrationFinishedEvent | GridMigrationStartedEvent | GroupArchiveEvent | GroupCloseEvent | GroupDeletedEvent | GroupHistoryChangedEvent | GroupLeftEvent | GroupOpenEvent | GroupRenameEvent | GroupUnarchiveEvent | IMCloseEvent | IMCreatedEvent | IMHistoryChangedEvent | IMOpenEvent | InviteRequestedEvent | LinkSharedEvent | MemberJoinedChannelEvent | MemberLeftChannelEvent | AllMessageEvents | AllMessageMetadataEvents | PinAddedEvent | PinRemovedEvent | ReactionAddedEvent | ReactionRemovedEvent | SharedChannelInviteAcceptedEvent | SharedChannelInviteApprovedEvent | SharedChannelInviteDeclinedEvent | SharedChannelInviteReceivedEvent | SharedChannelInviteRequestedEvent | StarAddedEvent | StarRemovedEvent | SubteamCreatedEvent | SubteamMembersChangedEvent | SubteamSelfAddedEvent | SubteamSelfRemovedEvent | SubteamUpdatedEvent | TeamAccessGrantedEvent | TeamAccessRevokedEvent | TeamDomainChangeEvent | TeamJoinEvent | TeamRenameEvent | TokensRevokedEvent | UserChangeEvent | UserHuddleChangedEvent | UserProfileChangedEvent | UserStatusChangedEvent | WorkflowDeletedEvent | WorkflowPublishedEvent | WorkflowStepDeletedEvent | WorkflowStepExecuteEvent | WorkflowUnpublishedEvent;
12
```
13
14
### App Events
15
16
Events related to app lifecycle and installation.
17
18
```typescript { .api }
19
interface AppDeletedEvent {
20
type: 'app_deleted';
21
app_id: string;
22
}
23
24
interface AppHomeOpenedEvent {
25
type: 'app_home_opened';
26
user: string;
27
channel: string;
28
tab: 'home' | 'messages';
29
event_ts: string;
30
}
31
32
interface AppInstalledEvent {
33
type: 'app_installed';
34
app_id: string;
35
app_name: string;
36
app_owner_id: string;
37
user_id: string;
38
team_id: string;
39
}
40
41
interface AppMentionEvent {
42
type: 'app_mention';
43
user: string;
44
text: string;
45
ts: string;
46
channel: string;
47
event_ts: string;
48
thread_ts?: string;
49
blocks?: AnyBlock[];
50
}
51
52
interface AppRateLimitedEvent {
53
type: 'app_rate_limited';
54
token: string;
55
team_id: string;
56
minute_rate_limited: number;
57
api_app_id: string;
58
}
59
60
interface AppRequestedEvent {
61
type: 'app_requested';
62
app_request: {
63
id: string;
64
app: {
65
id: string;
66
name: string;
67
description: string;
68
help_url: string;
69
privacy_policy_url: string;
70
app_homepage_url: string;
71
};
72
previous_resolution: {
73
status: 'approved' | 'restricted';
74
scopes: {
75
name: string;
76
description: string;
77
is_sensitive: boolean;
78
token_type: string;
79
}[];
80
} | null;
81
user: {
82
id: string;
83
name: string;
84
email: string;
85
};
86
team: {
87
id: string;
88
name: string;
89
domain: string;
90
};
91
scopes: {
92
name: string;
93
description: string;
94
is_sensitive: boolean;
95
token_type: string;
96
}[];
97
message: string;
98
date_created: number;
99
};
100
}
101
102
interface AppUninstalledEvent {
103
type: 'app_uninstalled';
104
}
105
106
interface AppUninstalledTeamEvent {
107
type: 'app_uninstalled_team';
108
team_ids: string[];
109
}
110
```
111
112
### Channel Events
113
114
Events for channel lifecycle and membership changes.
115
116
```typescript { .api }
117
interface ChannelArchiveEvent {
118
type: 'channel_archive';
119
channel: string;
120
user: string;
121
}
122
123
interface ChannelCreatedEvent {
124
type: 'channel_created';
125
channel: {
126
id: string;
127
name: string;
128
created: number;
129
creator: string;
130
};
131
}
132
133
interface ChannelDeletedEvent {
134
type: 'channel_deleted';
135
channel: string;
136
}
137
138
interface ChannelHistoryChangedEvent {
139
type: 'channel_history_changed';
140
latest: string;
141
ts: string;
142
event_ts: string;
143
}
144
145
interface ChannelIDChangedEvent {
146
type: 'channel_id_changed';
147
old_channel_id: string;
148
new_channel_id: string;
149
event_ts: string;
150
}
151
152
interface ChannelLeftEvent {
153
type: 'channel_left';
154
channel: string;
155
user: string;
156
}
157
158
interface ChannelRenameEvent {
159
type: 'channel_rename';
160
channel: {
161
id: string;
162
name: string;
163
created: number;
164
};
165
}
166
167
interface ChannelSharedEvent {
168
type: 'channel_shared';
169
connected_team_id: string;
170
channel: string;
171
event_ts: string;
172
}
173
174
interface ChannelUnarchiveEvent {
175
type: 'channel_unarchive';
176
channel: string;
177
user: string;
178
}
179
180
interface ChannelUnsharedEvent {
181
type: 'channel_unshared';
182
previously_connected_team_id: string;
183
channel: string;
184
is_ext_shared: boolean;
185
event_ts: string;
186
}
187
```
188
189
### Message Events
190
191
The most commonly used events for message handling.
192
193
```typescript { .api }
194
type AllMessageEvents = MessageEvent | MessageBotEvent | MessageChannelArchiveEvent | MessageChannelJoinEvent | MessageChannelLeaveEvent | MessageChannelNameEvent | MessageChannelPurposeEvent | MessageChannelTopicEvent | MessageChannelUnarchiveEvent | MessageEkmAccessDeniedEvent | MessageFileShareEvent | MessageHuddleEvent | MessageMeEvent | MessageMessageChangedEvent | MessageMessageDeletedEvent | MessageMessageRepliedEvent | MessageReminderAddEvent | MessageSlackbotResponseEvent | MessageThreadBroadcastEvent;
195
196
interface MessageEvent {
197
type: 'message';
198
channel: string;
199
user: string;
200
text: string;
201
ts: string;
202
thread_ts?: string;
203
blocks?: AnyBlock[];
204
attachments?: MessageAttachment[];
205
files?: any[];
206
upload?: boolean;
207
user_team?: string;
208
source_team?: string;
209
edited?: {
210
user: string;
211
ts: string;
212
};
213
client_msg_id?: string;
214
app_id?: string;
215
bot_id?: string;
216
username?: string;
217
team?: string;
218
parent_user_id?: string;
219
reply_count?: number;
220
reply_users_count?: number;
221
latest_reply?: string;
222
reply_users?: string[];
223
is_locked?: boolean;
224
subscribed?: boolean;
225
last_read?: string;
226
unread_count?: number;
227
root?: MessageEvent;
228
}
229
230
interface MessageBotEvent {
231
type: 'message';
232
subtype: 'bot_message';
233
channel: string;
234
bot_id: string;
235
username?: string;
236
text: string;
237
ts: string;
238
thread_ts?: string;
239
blocks?: AnyBlock[];
240
attachments?: MessageAttachment[];
241
icons?: {
242
[key: string]: string;
243
};
244
app_id?: string;
245
}
246
247
interface MessageMessageChangedEvent {
248
type: 'message';
249
subtype: 'message_changed';
250
hidden: boolean;
251
channel: string;
252
ts: string;
253
message: MessageEvent;
254
previous_message: MessageEvent;
255
event_ts: string;
256
}
257
258
interface MessageMessageDeletedEvent {
259
type: 'message';
260
subtype: 'message_deleted';
261
hidden: boolean;
262
channel: string;
263
ts: string;
264
deleted_ts: string;
265
event_ts: string;
266
previous_message: MessageEvent;
267
}
268
```
269
270
### User Events
271
272
Events related to user profile and status changes.
273
274
```typescript { .api }
275
interface UserChangeEvent {
276
type: 'user_change';
277
user: {
278
id: string;
279
team_id: string;
280
name: string;
281
deleted: boolean;
282
color: string;
283
real_name: string;
284
tz: string;
285
tz_label: string;
286
tz_offset: number;
287
profile: {
288
title: string;
289
phone: string;
290
skype: string;
291
real_name: string;
292
real_name_normalized: string;
293
display_name: string;
294
display_name_normalized: string;
295
fields: any;
296
status_text: string;
297
status_emoji: string;
298
status_emoji_display_info: StatusEmojiDisplayInfo[];
299
status_expiration: number;
300
avatar_hash: string;
301
image_original?: string;
302
is_custom_image?: boolean;
303
email?: string;
304
first_name: string;
305
last_name: string;
306
image_24: string;
307
image_32: string;
308
image_48: string;
309
image_72: string;
310
image_192: string;
311
image_512: string;
312
image_1024?: string;
313
status_text_canonical?: string;
314
team: string;
315
};
316
is_admin: boolean;
317
is_owner: boolean;
318
is_primary_owner: boolean;
319
is_restricted: boolean;
320
is_ultra_restricted: boolean;
321
is_bot: boolean;
322
is_app_user: boolean;
323
updated: number;
324
is_email_confirmed: boolean;
325
who_can_share_contact_card: string;
326
locale?: string;
327
};
328
cache_ts: number;
329
event_ts: string;
330
}
331
332
interface UserProfileChangedEvent {
333
type: 'user_profile_changed';
334
user: {
335
id: string;
336
team_id: string;
337
name: string;
338
deleted: boolean;
339
color: string;
340
real_name: string;
341
tz: string;
342
tz_label: string;
343
tz_offset: number;
344
profile: {
345
title: string;
346
phone: string;
347
skype: string;
348
real_name: string;
349
real_name_normalized: string;
350
display_name: string;
351
display_name_normalized: string;
352
fields: any;
353
status_text: string;
354
status_emoji: string;
355
status_emoji_display_info: StatusEmojiDisplayInfo[];
356
status_expiration: number;
357
avatar_hash: string;
358
email?: string;
359
first_name: string;
360
last_name: string;
361
image_24: string;
362
image_32: string;
363
image_48: string;
364
image_72: string;
365
image_192: string;
366
image_512: string;
367
status_text_canonical?: string;
368
team: string;
369
};
370
is_admin: boolean;
371
is_owner: boolean;
372
is_primary_owner: boolean;
373
is_restricted: boolean;
374
is_ultra_restricted: boolean;
375
is_bot: boolean;
376
is_app_user: boolean;
377
updated: number;
378
is_email_confirmed: boolean;
379
who_can_share_contact_card: string;
380
};
381
cache_ts: number;
382
event_ts: string;
383
}
384
385
interface UserStatusChangedEvent {
386
type: 'user_status_changed';
387
user: {
388
id: string;
389
team_id: string;
390
name: string;
391
deleted: boolean;
392
color: string;
393
real_name: string;
394
tz: string;
395
tz_label: string;
396
tz_offset: number;
397
profile: {
398
status_text: string;
399
status_emoji: string;
400
status_emoji_display_info: StatusEmojiDisplayInfo[];
401
status_expiration: number;
402
avatar_hash: string;
403
display_name: string;
404
real_name: string;
405
real_name_normalized: string;
406
email?: string;
407
image_24: string;
408
image_32: string;
409
image_48: string;
410
image_72: string;
411
image_192: string;
412
image_512: string;
413
first_name: string;
414
last_name: string;
415
title: string;
416
phone: string;
417
skype: string;
418
fields: any;
419
status_text_canonical?: string;
420
team: string;
421
};
422
is_admin: boolean;
423
is_owner: boolean;
424
is_primary_owner: boolean;
425
is_restricted: boolean;
426
is_ultra_restricted: boolean;
427
is_bot: boolean;
428
is_app_user: boolean;
429
updated: number;
430
is_email_confirmed: boolean;
431
};
432
cache_ts: number;
433
event_ts: string;
434
}
435
436
interface UserHuddleChangedEvent {
437
type: 'user_huddle_changed';
438
user: {
439
id: string;
440
team_id: string;
441
name: string;
442
deleted: boolean;
443
color: string;
444
real_name: string;
445
tz: string;
446
tz_label: string;
447
tz_offset: number;
448
profile: {
449
avatar_hash: string;
450
status_text: string;
451
status_emoji: string;
452
real_name: string;
453
display_name: string;
454
real_name_normalized: string;
455
display_name_normalized: string;
456
email?: string;
457
image_original?: string;
458
image_24: string;
459
image_32: string;
460
image_48: string;
461
image_72: string;
462
image_192: string;
463
image_512: string;
464
team: string;
465
first_name: string;
466
last_name: string;
467
title: string;
468
phone: string;
469
skype: string;
470
huddle_state: string;
471
huddle_state_expiration_ts: number;
472
};
473
is_admin: boolean;
474
is_owner: boolean;
475
is_primary_owner: boolean;
476
is_restricted: boolean;
477
is_ultra_restricted: boolean;
478
is_bot: boolean;
479
is_app_user: boolean;
480
updated: number;
481
is_email_confirmed: boolean;
482
};
483
cache_ts: number;
484
event_ts: string;
485
}
486
```
487
488
### File Events
489
490
Events for file sharing and management.
491
492
```typescript { .api }
493
interface FileCreatedEvent {
494
type: 'file_created';
495
file_id: string;
496
user_id: string;
497
}
498
499
interface FileDeletedEvent {
500
type: 'file_deleted';
501
file_id: string;
502
event_ts: string;
503
}
504
505
interface FilePublicEvent {
506
type: 'file_public';
507
file_id: string;
508
user_id: string;
509
}
510
511
interface FileSharedEvent {
512
type: 'file_shared';
513
file_id: string;
514
user_id: string;
515
}
516
517
interface FileUnsharedEvent {
518
type: 'file_unshared';
519
file_id: string;
520
user_id: string;
521
}
522
523
interface FileChangeEvent {
524
type: 'file_change';
525
file_id: string;
526
file: {
527
id: string;
528
};
529
}
530
531
interface FileCommentDeletedEvent {
532
type: 'file_comment_deleted';
533
comment: string;
534
file_id: string;
535
}
536
```
537
538
### Reaction Events
539
540
Events for emoji reactions on messages.
541
542
```typescript { .api }
543
interface ReactionAddedEvent {
544
type: 'reaction_added';
545
user: string;
546
reaction: string;
547
item_user: string;
548
item: {
549
type: string;
550
channel: string;
551
ts: string;
552
};
553
event_ts: string;
554
}
555
556
interface ReactionRemovedEvent {
557
type: 'reaction_removed';
558
user: string;
559
reaction: string;
560
item_user: string;
561
item: {
562
type: string;
563
channel: string;
564
ts: string;
565
};
566
event_ts: string;
567
}
568
```
569
570
### Team Events
571
572
Workspace-level events.
573
574
```typescript { .api }
575
interface TeamJoinEvent {
576
type: 'team_join';
577
user: {
578
id: string;
579
team_id: string;
580
name: string;
581
deleted: boolean;
582
color: string;
583
real_name: string;
584
tz: string;
585
tz_label: string;
586
tz_offset: number;
587
profile: any;
588
is_admin: boolean;
589
is_owner: boolean;
590
is_primary_owner: boolean;
591
is_restricted: boolean;
592
is_ultra_restricted: boolean;
593
is_bot: boolean;
594
is_app_user: boolean;
595
updated: number;
596
is_email_confirmed: boolean;
597
};
598
}
599
600
interface TeamRenameEvent {
601
type: 'team_rename';
602
name: string;
603
}
604
605
interface TeamDomainChangeEvent {
606
type: 'team_domain_change';
607
url: string;
608
domain: string;
609
}
610
611
interface TeamAccessGrantedEvent {
612
type: 'team_access_granted';
613
team_ids: string[];
614
}
615
616
interface TeamAccessRevokedEvent {
617
type: 'team_access_revoked';
618
team_ids: string[];
619
}
620
```
621
622
### Other Event Categories
623
624
The events system also includes:
625
626
- **Assistant Events**: AI assistant thread events (`AssistantThreadStartedEvent`, `AssistantThreadContextChangedEvent`)
627
- **Call Events**: Call rejection events (`CallRejectedEvent`)
628
- **DND Events**: Do not disturb status events (`DNDUpdatedEvent`, `DNDUpdatedUserEvent`)
629
- **Email Events**: Domain change events (`EmailDomainChangedEvent`)
630
- **Emoji Events**: Custom emoji changes (`EmojiChangedEvent`)
631
- **Function Events**: Workflow function execution (`FunctionExecutedEvent`)
632
- **Grid Migration Events**: Enterprise Grid events (`GridMigrationStartedEvent`, `GridMigrationFinishedEvent`)
633
- **Group Events**: Private channel events (8 event types)
634
- **IM Events**: Direct message events (4 event types)
635
- **Invite Events**: Workspace invitation events (`InviteRequestedEvent`)
636
- **Link Shared Events**: URL unfurling events (`LinkSharedEvent`)
637
- **Member Events**: Channel membership events (`MemberJoinedChannelEvent`, `MemberLeftChannelEvent`)
638
- **Message Metadata Events**: Metadata-related events (4 event types)
639
- **Pin Events**: Message pinning events (`PinAddedEvent`, `PinRemovedEvent`)
640
- **Shared Channel Events**: Slack Connect events (5 event types)
641
- **Star Events**: Message starring events (`StarAddedEvent`, `StarRemovedEvent`)
642
- **Steps from Apps Events**: Deprecated workflow events (5 event types)
643
- **Subteam Events**: User group events (5 event types)
644
- **Token Events**: Token revocation events (`TokensRevokedEvent`)
645
646
## Common Event Patterns
647
648
All events follow consistent patterns:
649
650
- **type**: Discriminator field for the event type
651
- **event_ts**: Timestamp when the event occurred
652
- **user**: ID of the user who triggered the event (when applicable)
653
- **channel**: Channel where the event occurred (when applicable)
654
- **team_id**: Team/workspace ID (usually in envelope, not event body)
655
656
Events are delivered in an envelope structure with additional metadata like API app ID, team ID, and event subscription info.