0
# Reactions
1
2
Add, remove, and retrieve emoji reactions on messages, files, and file comments. Reactions provide a lightweight way for users to express sentiment or acknowledgment without sending full messages.
3
4
## Capabilities
5
6
### Add Reaction
7
8
Add an emoji reaction to a message, file, or file comment.
9
10
```typescript { .api }
11
/**
12
* Add a reaction to an item
13
* @param options - Reaction parameters with target item and emoji
14
* @returns Promise resolving to success confirmation
15
*/
16
reactions.add(options: ReactionsAddArguments): Promise<ReactionsAddResponse>;
17
18
interface ReactionsAddArguments extends MessageArgument, TokenOverridable, ReactionName {}
19
20
interface ReactionName {
21
/** Reaction (emoji) name without colons (e.g., 'thumbsup', 'heart') */
22
name: string;
23
}
24
25
interface MessageArgument {
26
/** Channel containing the message */
27
channel: string;
28
/** Timestamp of the message to add reaction to */
29
timestamp: string;
30
}
31
32
interface ReactionsAddResponse extends WebAPICallResult {
33
/** Whether the reaction was successfully added */
34
ok: boolean;
35
}
36
```
37
38
**Usage Examples:**
39
40
```typescript
41
import { WebClient } from "@slack/web-api";
42
43
const web = new WebClient(process.env.SLACK_BOT_TOKEN);
44
45
// Add thumbs up reaction to a message
46
await web.reactions.add({
47
channel: "C1234567890",
48
timestamp: "1234567890.123456",
49
name: "thumbsup"
50
});
51
52
// Add custom emoji reaction
53
await web.reactions.add({
54
channel: "C1234567890",
55
timestamp: "1234567890.123456",
56
name: "custom_emoji"
57
});
58
```
59
60
### Get Reactions
61
62
Retrieve reactions for a specific message, file, or file comment.
63
64
```typescript { .api }
65
/**
66
* Get reactions for an item
67
* @param options - Target item parameters
68
* @returns Promise resolving to reaction details
69
*/
70
reactions.get(options: ReactionsGetArguments): Promise<ReactionsGetResponse>;
71
72
type ReactionsGetArguments = ReactionsFull & TokenOverridable & (MessageArgument | FileArgument | FileCommentArgument);
73
74
interface ReactionsFull {
75
/** If true, return the complete reaction list */
76
full?: boolean;
77
}
78
79
interface FileArgument {
80
/** File ID to get reactions for */
81
file: string;
82
}
83
84
interface FileCommentArgument {
85
/** File comment ID to get reactions for */
86
file_comment: string;
87
}
88
89
interface ReactionsGetResponse extends WebAPICallResult {
90
/** The item that has reactions */
91
message?: Message;
92
file?: File;
93
comment?: FileComment;
94
/** Type of item ('message', 'file', or 'file_comment') */
95
type?: string;
96
}
97
```
98
99
### List Reactions
100
101
List reactions made by a user across the workspace.
102
103
```typescript { .api }
104
/**
105
* List reactions made by a user
106
* @param options - Optional filtering and pagination parameters
107
* @returns Promise resolving to list of user's reactions
108
*/
109
reactions.list(options?: ReactionsListArguments): Promise<ReactionsListResponse>;
110
111
type ReactionsListArguments = OptionalArgument<
112
ReactionsFull &
113
TokenOverridable &
114
TraditionalPagingEnabled &
115
CursorPaginationEnabled &
116
OptionalTeamAssignable & {
117
/** Show reactions made by this user (defaults to authed user) */
118
user?: string;
119
}
120
>;
121
122
interface ReactionsListResponse extends WebAPICallResult {
123
/** Array of items with reactions */
124
items?: ReactionItem[];
125
/** Pagination information */
126
paging?: {
127
count: number;
128
total: number;
129
page: number;
130
pages: number;
131
};
132
/** Response metadata with cursor for pagination */
133
response_metadata?: {
134
next_cursor?: string;
135
};
136
}
137
138
interface ReactionItem {
139
/** Type of item reacted to */
140
type: string;
141
/** Channel containing the item */
142
channel?: string;
143
/** Message object (if type is 'message') */
144
message?: Message;
145
/** File object (if type is 'file') */
146
file?: File;
147
/** File comment object (if type is 'file_comment') */
148
comment?: FileComment;
149
}
150
```
151
152
### Remove Reaction
153
154
Remove an emoji reaction from a message, file, or file comment.
155
156
```typescript { .api }
157
/**
158
* Remove a reaction from an item
159
* @param options - Reaction parameters with target item and emoji
160
* @returns Promise resolving to success confirmation
161
*/
162
reactions.remove(options: ReactionsRemoveArguments): Promise<ReactionsRemoveResponse>;
163
164
type ReactionsRemoveArguments = TokenOverridable & ReactionName & (MessageArgument | FileArgument | FileCommentArgument);
165
166
interface ReactionsRemoveResponse extends WebAPICallResult {
167
/** Whether the reaction was successfully removed */
168
ok: boolean;
169
}
170
```
171
172
**Usage Examples:**
173
174
```typescript
175
// Remove thumbs up reaction from a message
176
await web.reactions.remove({
177
channel: "C1234567890",
178
timestamp: "1234567890.123456",
179
name: "thumbsup"
180
});
181
182
// Remove reaction from a file
183
await web.reactions.remove({
184
file: "F1234567890",
185
name: "heart"
186
});
187
188
// Remove reaction from a file comment
189
await web.reactions.remove({
190
file_comment: "Fc1234567890",
191
name: "thinking_face"
192
});
193
```
194
195
## Pagination
196
197
The `reactions.list` method supports both traditional and cursor-based pagination:
198
199
```typescript
200
// Traditional pagination
201
const page1 = await web.reactions.list({
202
count: 50,
203
page: 1
204
});
205
206
// Cursor-based pagination
207
const page1 = await web.reactions.list({
208
limit: 50
209
});
210
211
const page2 = await web.reactions.list({
212
limit: 50,
213
cursor: page1.response_metadata?.next_cursor
214
});
215
```
216
217
## Core Types
218
219
```typescript { .api }
220
interface TokenOverridable {
221
/** Override the default token for this request */
222
token?: string;
223
}
224
225
interface OptionalTeamAssignable {
226
/** Team ID for Enterprise Grid workspaces */
227
team_id?: string;
228
}
229
230
interface TraditionalPagingEnabled {
231
/** Number of items to return per page */
232
count?: number;
233
/** Page number for traditional pagination */
234
page?: number;
235
}
236
237
interface CursorPaginationEnabled {
238
/** Cursor token for pagination */
239
cursor?: string;
240
/** Maximum number of items to return */
241
limit?: number;
242
}
243
```