@pipedream/slack 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/actions/add-emoji-reaction/add-emoji-reaction.mjs +11 -8
  2. package/actions/archive-channel/archive-channel.mjs +14 -4
  3. package/actions/common/build-blocks.mjs +5 -4
  4. package/actions/common/send-message.mjs +1 -23
  5. package/actions/create-channel/create-channel.mjs +10 -5
  6. package/actions/create-reminder/create-reminder.mjs +8 -8
  7. package/actions/delete-file/delete-file.mjs +6 -4
  8. package/actions/delete-message/delete-message.mjs +10 -5
  9. package/actions/find-message/find-message.mjs +21 -13
  10. package/actions/find-user-by-email/find-user-by-email.mjs +8 -4
  11. package/actions/get-file/get-file.mjs +6 -11
  12. package/actions/invite-user-to-channel/invite-user-to-channel.mjs +6 -4
  13. package/actions/kick-user/kick-user.mjs +17 -4
  14. package/actions/list-channels/list-channels.mjs +8 -4
  15. package/actions/list-files/list-files.mjs +21 -13
  16. package/actions/{list-user-groups-users/list-user-groups-users.mjs → list-group-members/list-group-members.mjs} +12 -6
  17. package/actions/list-members-in-channel/list-members-in-channel.mjs +22 -4
  18. package/actions/list-replies/list-replies.mjs +12 -5
  19. package/actions/list-users/list-users.mjs +8 -4
  20. package/actions/reply-to-a-message/reply-to-a-message.mjs +10 -10
  21. package/actions/send-custom-message/send-custom-message.mjs +27 -8
  22. package/actions/send-large-message/send-large-message.mjs +8 -4
  23. package/actions/{send-message-private-channel/send-message-private-channel.mjs → send-message/send-message.mjs} +13 -7
  24. package/actions/set-channel-description/set-channel-description.mjs +32 -0
  25. package/actions/set-channel-topic/set-channel-topic.mjs +6 -4
  26. package/actions/set-status/set-status.mjs +44 -0
  27. package/actions/update-group-members/update-group-members.mjs +67 -0
  28. package/actions/update-message/update-message.mjs +10 -5
  29. package/actions/update-profile/update-profile.mjs +70 -13
  30. package/actions/upload-file/upload-file.mjs +6 -4
  31. package/actions/verify-slack-signature/verify-slack-signature.mjs +2 -2
  32. package/package.json +3 -2
  33. package/slack.app.mjs +72 -71
  34. package/sources/common/base.mjs +9 -0
  35. package/sources/new-channel-created/new-channel-created.mjs +1 -1
  36. package/sources/new-direct-message/new-direct-message.mjs +3 -1
  37. package/sources/new-direct-message/test-event.mjs +28 -0
  38. package/sources/new-interaction-event-received/README.md +13 -13
  39. package/sources/new-interaction-event-received/new-interaction-event-received.mjs +7 -8
  40. package/sources/new-interaction-event-received/test-event.mjs +86 -0
  41. package/sources/{new-mention/new-mention.mjs → new-keyword-mention/new-keyword-mention.mjs} +8 -30
  42. package/sources/new-keyword-mention/test-event.mjs +28 -0
  43. package/sources/new-message-in-channels/new-message-in-channels.mjs +1 -1
  44. package/sources/new-reaction-added/new-reaction-added.mjs +4 -1
  45. package/sources/new-reaction-added/test-event.mjs +193 -0
  46. package/sources/new-user-mention/new-user-mention.mjs +117 -0
  47. package/sources/new-user-mention/test-event.mjs +28 -0
  48. package/actions/add-star/add-star.mjs +0 -43
  49. package/actions/complete-reminder/complete-reminder.mjs +0 -23
  50. package/actions/delete-reminder/delete-reminder.mjs +0 -23
  51. package/actions/get-channel/get-channel.mjs +0 -23
  52. package/actions/get-reminder/get-reminder.mjs +0 -23
  53. package/actions/join-channel/join-channel.mjs +0 -23
  54. package/actions/leave-channel/leave-channel.mjs +0 -23
  55. package/actions/list-reminders/list-reminders.mjs +0 -24
  56. package/actions/remove-star/remove-star.mjs +0 -40
  57. package/actions/send-block-kit-message/send-block-kit-message.mjs +0 -43
  58. package/actions/send-direct-message/send-direct-message.mjs +0 -32
  59. package/actions/send-group-message/send-group-message.mjs +0 -32
  60. package/actions/send-message-public-channel/send-message-public-channel.mjs +0 -38
  61. package/actions/set-channel-purpose/set-channel-purpose.mjs +0 -30
  62. package/actions/unarchive-channel/unarchive-channel.mjs +0 -23
  63. package/actions/update-user-groups-users/update-user-groups-users.mjs +0 -45
  64. package/sources/new-star-added/new-star-added.mjs +0 -45
package/slack.app.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { WebClient } from "@slack/web-api";
2
2
  import constants from "./common/constants.mjs";
3
+ import { ConfigurationError } from "@pipedream/platform";
3
4
 
4
5
  export default {
5
6
  type: "app",
@@ -9,17 +10,26 @@ export default {
9
10
  type: "string",
10
11
  label: "User",
11
12
  description: "Select a user",
12
- async options({ prevContext }) {
13
+ async options({
14
+ prevContext, channelId,
15
+ }) {
13
16
  const types = [
14
17
  "im",
15
18
  ];
16
- const [
19
+ let [
17
20
  userNames,
18
21
  conversationsResp,
19
22
  ] = await Promise.all([
20
23
  prevContext.userNames ?? this.userNames(),
21
24
  this.availableConversations(types.join(), prevContext.cursor),
22
25
  ]);
26
+ if (channelId) {
27
+ const { members } = await this.sdk().conversations.members({
28
+ channel: channelId,
29
+ });
30
+ conversationsResp.conversations = conversationsResp.conversations
31
+ .filter((c) => members.includes(c.user || c.id));
32
+ }
23
33
  return {
24
34
  options: conversationsResp.conversations.map((c) => ({
25
35
  label: `@${userNames[c.user]}`,
@@ -55,22 +65,6 @@ export default {
55
65
  };
56
66
  },
57
67
  },
58
- users: {
59
- type: "string[]",
60
- label: "Users",
61
- description: "Select users",
62
- async options() {
63
- const userNames = await this.userNames();
64
- const users = [];
65
- for (const key of Object.keys(userNames)) {
66
- users.push({
67
- label: userNames[key],
68
- value: key,
69
- });
70
- }
71
- return users;
72
- },
73
- },
74
68
  userGroup: {
75
69
  type: "string",
76
70
  label: "User Group",
@@ -99,12 +93,16 @@ export default {
99
93
  type: "string",
100
94
  label: "Channel",
101
95
  description: "Select a public or private channel, or a user or group",
102
- async options({ prevContext }) {
96
+ async options({
97
+ prevContext, types,
98
+ }) {
103
99
  let {
104
- types,
105
100
  cursor,
106
101
  userNames: userNamesOrPromise,
107
102
  } = prevContext;
103
+ if (prevContext?.types) {
104
+ types = prevContext.types;
105
+ }
108
106
  if (types == null) {
109
107
  const { response_metadata: { scopes } } = await this.authTest();
110
108
  types = [
@@ -128,8 +126,11 @@ export default {
128
126
  userNamesOrPromise,
129
127
  this.availableConversations(types.join(), cursor),
130
128
  ]);
129
+ const conversations = userNames
130
+ ? conversationsResp.conversations
131
+ : conversationsResp.conversations.filter((c) => !c.is_im);
131
132
  return {
132
- options: conversationsResp.conversations.map((c) => {
133
+ options: conversations.map((c) => {
133
134
  if (c.is_im) {
134
135
  return {
135
136
  label: `Direct messaging with: @${userNames[c.user]}`,
@@ -162,7 +163,10 @@ export default {
162
163
  label: "Channel ID",
163
164
  description: "Select the channel's id.",
164
165
  async options({
165
- prevContext, types = [], channelsFilter = (channel) => channel, excludeArchived = true,
166
+ prevContext,
167
+ types = Object.values(constants.CHANNEL_TYPE),
168
+ channelsFilter = (channel) => channel,
169
+ excludeArchived = true,
166
170
  }) {
167
171
  const userNames = prevContext.userNames || await this.userNames();
168
172
  const {
@@ -217,27 +221,40 @@ export default {
217
221
  };
218
222
  },
219
223
  },
220
- notificationText: {
224
+ messageTs: {
221
225
  type: "string",
222
- label: "Notification Text",
223
- description: "Optionally provide a string for Slack to display as the new message notification (if you do not provide this, notification will be blank).",
224
- optional: true,
226
+ label: "Message Timestamp",
227
+ description: "Timestamp of a message",
228
+ async options({
229
+ channel, prevContext,
230
+ }) {
231
+ if (!channel) {
232
+ throw new ConfigurationError("Provide a Channel ID in order to retrieve Messages.");
233
+ }
234
+ const {
235
+ messages, response_metadata: { next_cursor: cursor },
236
+ } = await this.conversationsHistory({
237
+ channel,
238
+ cursor: prevContext?.cursor,
239
+ });
240
+ return {
241
+ options: messages.map(({
242
+ ts: value, text: label,
243
+ }) => ({
244
+ value,
245
+ label,
246
+ })),
247
+ context: {
248
+ cursor,
249
+ },
250
+ };
251
+ },
225
252
  },
226
253
  text: {
227
254
  type: "string",
228
255
  label: "Text",
229
256
  description: "Text of the message to send (see Slack's [formatting docs](https://api.slack.com/reference/surfaces/formatting)). This field is usually necessary, unless you're providing only attachments instead.",
230
257
  },
231
- name: {
232
- type: "string",
233
- label: "Name",
234
- description: "Name of a single key to set.",
235
- },
236
- value: {
237
- type: "string",
238
- label: "Value",
239
- description: "Value to set a single key to.",
240
- },
241
258
  topic: {
242
259
  type: "string",
243
260
  label: "Topic",
@@ -253,15 +270,24 @@ export default {
253
270
  label: "Query",
254
271
  description: "Search query.",
255
272
  },
256
- team_id: {
257
- type: "string",
258
- label: "Team ID",
259
- description: "The ID of the team.",
260
- },
261
273
  file: {
262
274
  type: "string",
263
275
  label: "File ID",
264
276
  description: "Specify a file by providing its ID.",
277
+ async options({
278
+ channel, page,
279
+ }) {
280
+ const { files } = await this.sdk().files.list({
281
+ channel,
282
+ page: page + 1,
283
+ });
284
+ return files?.map(({
285
+ id: value, name: label,
286
+ }) => ({
287
+ value,
288
+ label,
289
+ })) || [];
290
+ },
265
291
  },
266
292
  attachments: {
267
293
  type: "string",
@@ -286,13 +312,13 @@ export default {
286
312
  parse: {
287
313
  type: "string",
288
314
  label: "Parse",
289
- description: "Change how messages are treated. Defaults to none. See below.",
315
+ description: "Change how messages are treated. Defaults to none. By default, URLs will be hyperlinked. Set `parse` to `none` to remove the hyperlinks. The behavior of `parse` is different for text formatted with `mrkdwn`. By default, or when `parse` is set to `none`, `mrkdwn` formatting is implemented. To ignore `mrkdwn` formatting, set `parse` to full.",
290
316
  optional: true,
291
317
  },
292
318
  as_user: {
293
319
  type: "boolean",
294
320
  label: "Send as User",
295
- description: "Optionally pass `TRUE` to post the message as the authed user, instead of as a bot. Defaults to `FALSE`.",
321
+ description: "Optionally pass `TRUE` to post the message as the authenticated user, instead of as a bot. Defaults to `FALSE`.",
296
322
  default: false,
297
323
  optional: true,
298
324
  },
@@ -305,8 +331,8 @@ export default {
305
331
  },
306
332
  post_at: {
307
333
  label: "Schedule message",
308
- description: "Messages can only be scheduled up to 120 days in advance, and cannot be scheduled for the past. The datetime format should be a unix timestamp (e.g., `1650507616`, [see here](https://www.epochconverter.com/) for help with this format).",
309
- type: "integer",
334
+ description: "Messages can only be scheduled up to 120 days in advance, and cannot be scheduled for the past. The datetime should be in ISO 8601 format. (Example: `2014-01-01T00:00:00Z`)",
335
+ type: "string",
310
336
  optional: true,
311
337
  },
312
338
  username: {
@@ -336,7 +362,7 @@ export default {
336
362
  type: "string",
337
363
  },
338
364
  link_names: {
339
- type: "string",
365
+ type: "boolean",
340
366
  label: "Link Names",
341
367
  description: "Find and link channel names and usernames.",
342
368
  optional: true,
@@ -354,18 +380,6 @@ export default {
354
380
  description: "Provide the channel or conversation ID for the thread to reply to (e.g., if triggering on new Slack messages, enter `{{event.channel}}`). If the channel does not match the thread timestamp, a new message will be posted to this channel.",
355
381
  optional: true,
356
382
  },
357
- thread_ts: {
358
- label: "Thread Timestamp",
359
- type: "string",
360
- description: "Provide another message's `ts` value to make this message a reply (e.g., if triggering on new Slack messages, enter `{{event.ts}}`). Avoid using a reply's `ts` value; use its parent instead.",
361
- optional: true,
362
- },
363
- timestamp: {
364
- label: "Timestamp",
365
- type: "string",
366
- description: "Timestamp of the relevant data.",
367
- optional: true,
368
- },
369
383
  icon_url: {
370
384
  type: "string",
371
385
  label: "Icon (image URL)",
@@ -378,12 +392,6 @@ export default {
378
392
  description: "The message text introducing the file",
379
393
  optional: true,
380
394
  },
381
- count: {
382
- type: "integer",
383
- label: "Count",
384
- description: "Number of items to return per page.",
385
- optional: true,
386
- },
387
395
  email: {
388
396
  type: "string",
389
397
  label: "Email",
@@ -412,13 +420,6 @@ export default {
412
420
  label: "Keyword",
413
421
  description: "Keyword to monitor",
414
422
  },
415
- isUsername: {
416
- type: "boolean",
417
- label: "Is Username",
418
- description: "Filters out mentions of the keyword that are not a username",
419
- default: false,
420
- optional: true,
421
- },
422
423
  ignoreBot: {
423
424
  type: "boolean",
424
425
  label: "Ignore Bots",
@@ -92,6 +92,15 @@ export default {
92
92
  return info.user.name;
93
93
  });
94
94
  },
95
+ async getRealName(id) {
96
+ return this.maybeCached(`users_real_names:${id}`, async () => {
97
+ const info = await this.slack.sdk().users.info({
98
+ user: id,
99
+ });
100
+ if (!info.ok) throw new Error(info.error);
101
+ return info.user.real_name;
102
+ });
103
+ },
95
104
  async getBotName(id) {
96
105
  return this.maybeCached(`bots:${id}`, async () => {
97
106
  const info = await this.slack.sdk().bots.info({
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-channel-created",
7
7
  name: "New Channel Created (Instant)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  description: "Emit new event when a new channel is created.",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -1,10 +1,11 @@
1
1
  import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "slack-new-direct-message",
6
7
  name: "New Direct Message (Instant)",
7
- version: "1.0.14",
8
+ version: "1.0.15",
8
9
  description: "Emit new event when a message was posted in a direct message channel",
9
10
  type: "source",
10
11
  dedupe: "unique",
@@ -42,4 +43,5 @@ export default {
42
43
  return event;
43
44
  },
44
45
  },
46
+ sampleEmit,
45
47
  };
@@ -0,0 +1,28 @@
1
+ export default {
2
+ "user": "USLACKBOT",
3
+ "type": "message",
4
+ "ts": "1716401124.947359",
5
+ "text": "Feeling great!",
6
+ "team": "TS8319547",
7
+ "blocks": [
8
+ {
9
+ "type": "rich_text",
10
+ "block_id": "bid/",
11
+ "elements": [
12
+ {
13
+ "type": "rich_text_section",
14
+ "elements": [
15
+ {
16
+ "type": "text",
17
+ "text": "Feeling great!"
18
+ }
19
+ ]
20
+ }
21
+ ]
22
+ }
23
+ ],
24
+ "channel": "DS676Q73J",
25
+ "event_ts": "1716401124.947359",
26
+ "channel_type": "im",
27
+ "pipedream_msg_id": "pd_1716401126905_tjxu6josgz"
28
+ }
@@ -31,21 +31,21 @@ Then select a **************Channel************** you’d like to send the messa
31
31
  ```jsx
32
32
  [
33
33
  {
34
- type: "actions",
35
- elements: [
34
+ "type": "actions",
35
+ "elements": [
36
36
  {
37
- type: "button",
38
- text: {
39
- type: "plain_text",
40
- text: "Click Me",
41
- emoji: true,
37
+ "type": "button",
38
+ "text": {
39
+ "type": "plain_text",
40
+ "text": "Click Me",
41
+ "emoji": true
42
42
  },
43
- value: "click_me_123",
44
- action_id: "button_click",
45
- },
46
- ],
47
- },
48
- ];
43
+ "value": "click_me_123",
44
+ "action_id": "button_click"
45
+ }
46
+ ]
47
+ }
48
+ ]
49
49
  ```
50
50
 
51
51
  Your ******************Slack - Send Message Using Block Kit****************** should look like this:
@@ -1,11 +1,11 @@
1
1
  import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
- name: "New Interaction Events",
5
- version: "0.0.12",
5
+ name: "New Interaction Events (Instant)",
6
+ version: "0.0.13",
6
7
  key: "slack-new-interaction-event-received",
7
- description:
8
- "Emit new events on new Slack [interactivity events](https://api.slack.com/interactivity) sourced from [Block Kit interactive elements](https://api.slack.com/interactivity/components), [Slash commands](https://api.slack.com/interactivity/slash-commands), or [Shortcuts](https://api.slack.com/interactivity/shortcuts).",
8
+ description: "Emit new events on new Slack [interactivity events](https://api.slack.com/interactivity) sourced from [Block Kit interactive elements](https://api.slack.com/interactivity/components), [Slash commands](https://api.slack.com/interactivity/slash-commands), or [Shortcuts](https://api.slack.com/interactivity/shortcuts).",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -17,8 +17,7 @@ export default {
17
17
  action_ids: {
18
18
  type: "string[]",
19
19
  label: "Action IDs",
20
- description:
21
- "Filter interaction events by specific `action_id`'s to subscribe for new interaction events. If none are specified, all `action_ids` created via Pipedream will emit new events.",
20
+ description: "Filter interaction events by specific `action_id`'s to subscribe for new interaction events. If none are specified, all `action_ids` created via Pipedream will emit new events.",
22
21
  optional: true,
23
22
  default: [],
24
23
  },
@@ -29,8 +28,7 @@ export default {
29
28
  ],
30
29
  type: "string[]",
31
30
  label: "Channels",
32
- description:
33
- "Filter interaction events by one or more channels. If none selected, any interaction event in any channel will emit new events.",
31
+ description: "Filter interaction events by one or more channels. If none selected, any interaction event in any channel will emit new events.",
34
32
  optional: true,
35
33
  default: [],
36
34
  },
@@ -103,4 +101,5 @@ export default {
103
101
  },
104
102
  );
105
103
  },
104
+ sampleEmit,
106
105
  };
@@ -0,0 +1,86 @@
1
+ export default {
2
+ "event": {
3
+ "type": "block_actions",
4
+ "user": {
5
+ "id": "US676PZLY",
6
+ "username": "test.user",
7
+ "name": "test.user",
8
+ "team_id": "TS8319547"
9
+ },
10
+ "api_app_id": "AN9231S6L",
11
+ "token": "UYc82mtyZWRhvUXQ6TXrv4wq",
12
+ "container": {
13
+ "type": "message",
14
+ "message_ts": "1716402983.247149",
15
+ "channel_id": "CS8319KD5",
16
+ "is_ephemeral": false
17
+ },
18
+ "trigger_id": "7161731794692.892103311143.4020ed3595908eca11e4076438354dbb",
19
+ "team": {
20
+ "id": "TS8319547",
21
+ "domain": "test-j1q3506"
22
+ },
23
+ "enterprise": null,
24
+ "is_enterprise_install": false,
25
+ "channel": {
26
+ "id": "CS8319KD5",
27
+ "name": "testing"
28
+ },
29
+ "message": {
30
+ "subtype": "bot_message",
31
+ "text": "Click Me button Sent via <https://pipedream.com/@/p_6lCR5Nx?o=a&amp;a=slack|Pipedream>",
32
+ "username": "Pipedream",
33
+ "type": "message",
34
+ "ts": "1716402983.247149",
35
+ "bot_id": "BRTDL45RQ",
36
+ "app_id": "AN9231S6L",
37
+ "blocks": [
38
+ {
39
+ "type": "actions",
40
+ "block_id": "SJp0j",
41
+ "elements": [
42
+ {
43
+ "type": "button",
44
+ "action_id": "button_click",
45
+ "text": {
46
+ "type": "plain_text",
47
+ "text": "Click Me",
48
+ "emoji": true
49
+ },
50
+ "value": "click_me_123"
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "type": "context",
56
+ "block_id": "ysmBN",
57
+ "elements": [
58
+ {
59
+ "type": "mrkdwn",
60
+ "text": "Sent via <https://pipedream.com/@/p_6lCR5Nx?o=a&amp;a=slack|Pipedream>",
61
+ "verbatim": false
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ },
67
+ "state": {
68
+ "values": {}
69
+ },
70
+ "response_url": "https://hooks.slack.com/actions/TS8319547/7156351250101/J0w1NoVIXjChEwp4WQab4tcv",
71
+ "actions": [
72
+ {
73
+ "action_id": "button_click",
74
+ "block_id": "SJp0j",
75
+ "text": {
76
+ "type": "plain_text",
77
+ "text": "Click Me",
78
+ "emoji": true
79
+ },
80
+ "value": "click_me_123",
81
+ "type": "button",
82
+ "action_ts": "1716403200.549150"
83
+ }
84
+ ]
85
+ }
86
+ }
@@ -1,12 +1,13 @@
1
1
  import common from "../common/base.mjs";
2
2
  import constants from "../common/constants.mjs";
3
+ import sampleEmit from "./test-event.mjs";
3
4
 
4
5
  export default {
5
6
  ...common,
6
- key: "slack-new-mention",
7
- name: "New Mention (Instant)",
8
- version: "1.0.17",
9
- description: "Emit new event when a username or specific keyword is mentioned in a channel",
7
+ key: "slack-new-keyword-mention",
8
+ name: "New Keyword Mention (Instant)",
9
+ version: "0.0.1",
10
+ description: "Emit new event when a specific keyword is mentioned in a channel",
10
11
  type: "source",
11
12
  dedupe: "unique",
12
13
  props: {
@@ -37,12 +38,6 @@ export default {
37
38
  "keyword",
38
39
  ],
39
40
  },
40
- isUsername: {
41
- propDefinition: [
42
- common.props.slack,
43
- "isUsername",
44
- ],
45
- },
46
41
  ignoreBot: {
47
42
  propDefinition: [
48
43
  common.props.slack,
@@ -90,7 +85,7 @@ export default {
90
85
  }
91
86
  },
92
87
  getSummary() {
93
- return "New mention received";
88
+ return "New keyword mention received";
94
89
  },
95
90
  async processEvent(event) {
96
91
  const {
@@ -98,15 +93,7 @@ export default {
98
93
  subtype,
99
94
  bot_id: botId,
100
95
  text,
101
- blocks = [],
102
96
  } = event;
103
- const [
104
- {
105
- elements: [
106
- { elements = [] } = {},
107
- ] = [],
108
- } = {},
109
- ] = blocks;
110
97
 
111
98
  if (msgType !== "message") {
112
99
  console.log(`Ignoring event with unexpected type "${msgType}"`);
@@ -127,17 +114,7 @@ export default {
127
114
  }
128
115
 
129
116
  let emitEvent = false;
130
- if (this.isUsername && elements) {
131
- for (const item of elements) {
132
- if (item.user_id) {
133
- const username = await this.getUserName(item.user_id);
134
- if (username === this.keyword) {
135
- emitEvent = true;
136
- break;
137
- }
138
- }
139
- }
140
- } else if (text.indexOf(this.keyword) !== -1) {
117
+ if (text.indexOf(this.keyword) !== -1) {
141
118
  emitEvent = true;
142
119
  } else if (subtype === constants.SUBTYPE.PD_HISTORY_MESSAGE) {
143
120
  emitEvent = true;
@@ -148,4 +125,5 @@ export default {
148
125
  }
149
126
  },
150
127
  },
128
+ sampleEmit,
151
129
  };
@@ -0,0 +1,28 @@
1
+ export default {
2
+ "user": "US676PZLY",
3
+ "type": "message",
4
+ "ts": "1716404766.096289",
5
+ "client_msg_id": "b26387fd-5afe-46a9-bf63-a7aabd6fb40f",
6
+ "text": "hello",
7
+ "team": "TS8319547",
8
+ "blocks": [
9
+ {
10
+ "type": "rich_text",
11
+ "block_id": "aY6KK",
12
+ "elements": [
13
+ {
14
+ "type": "rich_text_section",
15
+ "elements": [
16
+ {
17
+ "type": "text",
18
+ "text": "hello"
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "channel": "CS8319KD5",
26
+ "event_ts": "1716404766.096289",
27
+ "channel_type": "channel"
28
+ }
@@ -6,7 +6,7 @@ export default {
6
6
  ...common,
7
7
  key: "slack-new-message-in-channels",
8
8
  name: "New Message In Channels (Instant)",
9
- version: "1.0.16",
9
+ version: "1.0.17",
10
10
  description: "Emit new event when a new message is posted to one or more channels",
11
11
  type: "source",
12
12
  dedupe: "unique",
@@ -1,10 +1,11 @@
1
1
  import common from "../common/base.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "slack-new-reaction-added",
6
7
  name: "New Reaction Added (Instant)",
7
- version: "1.1.18",
8
+ version: "1.1.19",
8
9
  description: "Emit new event when a member has added an emoji reaction to a message",
9
10
  type: "source",
10
11
  dedupe: "unique",
@@ -54,6 +55,7 @@ export default {
54
55
  optional: true,
55
56
  },
56
57
  includeUserData: {
58
+ label: "Include User Data",
57
59
  description: "Include user object in the response. Default `false`",
58
60
  type: "boolean",
59
61
  optional: true,
@@ -103,4 +105,5 @@ export default {
103
105
  return event;
104
106
  },
105
107
  },
108
+ sampleEmit,
106
109
  };