@pipedream/slack_v2 0.7.0 → 1.0.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 +2 -2
  2. package/actions/add-reaction/add-reaction.mjs +2 -1
  3. package/actions/archive-channel/archive-channel.mjs +3 -10
  4. package/actions/browse-files/browse-files.mjs +2 -1
  5. package/actions/common/build-blocks.mjs +44 -106
  6. package/actions/common/send-message.mjs +5 -59
  7. package/actions/create-channel/create-channel.mjs +2 -1
  8. package/actions/create-reminder/create-reminder.mjs +2 -1
  9. package/actions/delete-file/delete-file.mjs +2 -4
  10. package/actions/delete-message/delete-message.mjs +8 -6
  11. package/actions/edit-message/edit-message.mjs +21 -2
  12. package/actions/find-message/find-message.mjs +2 -1
  13. package/actions/find-user-by-email/find-user-by-email.mjs +2 -1
  14. package/actions/find-user-by-id/find-user-by-id.mjs +4 -3
  15. package/actions/get-channel-details/get-channel-details.mjs +3 -2
  16. package/actions/get-channel-history/get-channel-history.mjs +8 -6
  17. package/actions/get-current-user/get-current-user.mjs +3 -2
  18. package/actions/get-file/get-file.mjs +2 -12
  19. package/actions/get-thread-replies/get-thread-replies.mjs +2 -1
  20. package/actions/get-user-details/get-user-details.mjs +2 -1
  21. package/actions/invite-user-to-channel/invite-user-to-channel.mjs +2 -1
  22. package/actions/kick-user/kick-user.mjs +2 -12
  23. package/actions/list-channels/list-channels.mjs +29 -10
  24. package/actions/list-emojis/list-emojis.mjs +2 -1
  25. package/actions/list-files/list-files.mjs +6 -11
  26. package/actions/list-group-conversations/list-group-conversations.mjs +86 -0
  27. package/actions/list-group-members/list-group-members.mjs +3 -2
  28. package/actions/list-icon-emoji-options/list-icon-emoji-options.mjs +6 -3
  29. package/actions/list-members-in-channel/list-members-in-channel.mjs +2 -1
  30. package/actions/list-messages/list-messages.mjs +8 -3
  31. package/actions/list-reminder-options/list-reminder-options.mjs +10 -3
  32. package/actions/list-replies/list-replies.mjs +2 -9
  33. package/actions/list-teams/list-teams.mjs +88 -0
  34. package/actions/list-user-group-options/list-user-group-options.mjs +10 -3
  35. package/actions/list-users/list-users.mjs +2 -1
  36. package/actions/post-message/post-message.mjs +30 -3
  37. package/actions/reply-to-a-message/reply-to-a-message.mjs +13 -12
  38. package/actions/search/search.mjs +2 -1
  39. package/actions/send-block-kit-message/send-block-kit-message.mjs +2 -1
  40. package/actions/send-large-message/send-large-message.mjs +2 -1
  41. package/actions/send-message/send-message.mjs +5 -15
  42. package/actions/send-message-advanced/send-message-advanced.mjs +46 -4
  43. package/actions/send-message-to-channel/send-message-to-channel.mjs +10 -10
  44. package/actions/send-message-to-user-or-group/send-message-to-user-or-group.mjs +4 -9
  45. package/actions/set-channel-description/set-channel-description.mjs +2 -1
  46. package/actions/set-channel-topic/set-channel-topic.mjs +2 -1
  47. package/actions/set-status/set-status.mjs +4 -3
  48. package/actions/update-group-members/update-group-members.mjs +5 -4
  49. package/actions/update-message/update-message.mjs +3 -2
  50. package/actions/update-profile/update-profile.mjs +3 -2
  51. package/actions/upload-file/upload-file.mjs +7 -2
  52. package/actions/verify-slack-signature/verify-slack-signature.mjs +4 -3
  53. package/common/constants.mjs +16 -0
  54. package/package.json +2 -2
  55. package/slack_v2.app.mjs +43 -370
  56. package/sources/new-channel-created/new-channel-created.mjs +1 -1
  57. package/sources/new-interaction-event-received/new-interaction-event-received.mjs +1 -1
  58. package/sources/new-keyword-mention/new-keyword-mention.mjs +1 -1
  59. package/sources/new-message-in-channels/new-message-in-channels.mjs +1 -1
  60. package/sources/new-private-channel-created/new-private-channel-created.mjs +1 -1
  61. package/sources/new-reaction-added/new-reaction-added.mjs +1 -1
  62. package/sources/new-saved-message/new-saved-message.mjs +1 -1
  63. package/sources/new-user-added/new-user-added.mjs +1 -1
  64. package/sources/new-user-mention/new-user-mention.mjs +1 -1
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import utils from "../../common/utils.mjs";
2
3
  import slack from "../../slack_v2.app.mjs";
3
4
 
@@ -5,16 +6,17 @@ export default {
5
6
  key: "slack_v2-get-channel-history",
6
7
  name: "Get Channel History",
7
8
  description:
8
- "Read the recent message history from a specific channel."
9
+ "Read the recent message history from a specific channel or direct message (DM)."
9
10
  + " Accepts a channel ID or channel name (resolved automatically)."
10
- + " Use this when you want to see a channel's latest messagesunlike **Search** which finds messages by keyword."
11
+ + " To read a DM, pass the other person's **user ID** (e.g. `U1234567890`) as the channel pass your OWN user ID to read your conversation with yourself."
12
+ + " Use this when you want to see a channel's or DM's latest messages — unlike **Search** which finds messages by keyword."
11
13
  + " Returns messages with text, timestamps (ts), reactions, and user IDs."
12
14
  + " Message timestamps can be used with **Get Thread Replies**, **Edit Message**, and **Add Reaction**."
13
15
  + " **Pass `fields`** (e.g. `text,ts,user`) unless you need full message objects — raw Slack"
14
16
  + " messages carry blocks, attachments and edit metadata, so a busy channel can run to tens"
15
17
  + " of thousands of characters and be truncated before you see any of it."
16
18
  + " [See the documentation](https://api.slack.com/methods/conversations.history)",
17
- version: "0.1.0",
19
+ version: "0.2.1",
18
20
  type: "action",
19
21
  annotations: {
20
22
  destructiveHint: false,
@@ -26,7 +28,7 @@ export default {
26
28
  channel: {
27
29
  type: "string",
28
30
  label: "Channel",
29
- description: "Channel ID (e.g. `C1234567890`) or channel name (e.g. `general` or `#general`). Resolved automatically.",
31
+ description: "Channel ID (e.g. `C1234567890`) or channel name (e.g. `general` or `#general`). For a direct message, pass a user ID (e.g. `U1234567890`) — including your own, to read your self-DM. Resolved automatically.",
30
32
  },
31
33
  limit: {
32
34
  type: "integer",
@@ -38,13 +40,13 @@ export default {
38
40
  oldest: {
39
41
  type: "string",
40
42
  label: "Oldest",
41
- description: "Only messages after this Unix timestamp. Inclusive.",
43
+ description: "Only return messages posted after this timestamp (inclusive), as a Slack timestamp, e.g. `1610000000.000000` (Unix epoch seconds, optionally with fractional microseconds).",
42
44
  optional: true,
43
45
  },
44
46
  latest: {
45
47
  type: "string",
46
48
  label: "Latest",
47
- description: "Only messages before this Unix timestamp. Default: now.",
49
+ description: "Only return messages posted before this timestamp. Defaults to now. Same format as `Oldest`, e.g. `1610000000.000000`.",
48
50
  optional: true,
49
51
  },
50
52
  fields: {
@@ -1,10 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-get-current-user",
5
6
  name: "Get Current User",
6
- description: "Do NOT use for a plain \"who am I\" / \"what's my user ID\" question — call **Get User Details** for that; it answers the same question with a far smaller payload. Use this ONLY when you specifically need the full member profile: locale, timezone, presence/status, admin and owner flags, name variants, or workspace domain and enterprise metadata. Combines `auth.test`, `users.info`, `users.profile.get` and `team.info`. [See Slack API docs](https://api.slack.com/methods/auth.test).",
7
- version: "0.0.5",
7
+ description: "Do NOT use for a plain \"who am I\" / \"what's my user ID\" question — call **Get User Details** for that; it answers the same question with a far smaller payload. Do NOT use to look up a DIFFERENT, specifically-identified user (by ID or email) — this only ever describes the authenticated caller; use **Find User by ID** / **Find User by Email** for someone else. Do NOT use to enumerate multiple teams/workspaces (e.g. Enterprise Grid) — use **List Teams** for that; this returns only the caller's own current team. Use this ONLY when you specifically need the full member profile: locale, timezone, presence/status, admin and owner flags, name variants, or workspace domain and enterprise metadata. Combines `auth.test`, `users.info`, `users.profile.get` and `team.info`. [See Slack API docs](https://api.slack.com/methods/auth.test).",
8
+ version: "0.0.7",
8
9
  type: "action",
9
10
  annotations: {
10
11
  destructiveHint: false,
@@ -1,11 +1,11 @@
1
- import constants from "../../common/constants.mjs";
1
+ // x-pd-ai: optimized
2
2
  import slack from "../../slack_v2.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "slack_v2-get-file",
6
6
  name: "Get File",
7
7
  description: "Return information about a file. [See the documentation](https://api.slack.com/methods/files.info)",
8
- version: "0.1.5",
8
+ version: "0.1.7",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -18,14 +18,7 @@ export default {
18
18
  propDefinition: [
19
19
  slack,
20
20
  "conversation",
21
- () => ({
22
- types: [
23
- constants.CHANNEL_TYPE.PUBLIC,
24
- constants.CHANNEL_TYPE.PRIVATE,
25
- ],
26
- }),
27
21
  ],
28
- description: "Select a public or private channel",
29
22
  },
30
23
  addToChannel: {
31
24
  propDefinition: [
@@ -37,9 +30,6 @@ export default {
37
30
  propDefinition: [
38
31
  slack,
39
32
  "file",
40
- (c) => ({
41
- channel: c.conversation,
42
- }),
43
33
  ],
44
34
  },
45
35
  },
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import utils from "../../common/utils.mjs";
2
3
  import slack from "../../slack_v2.app.mjs";
3
4
 
@@ -13,7 +14,7 @@ export default {
13
14
  + " Slack messages carry blocks, attachments and edit metadata, so a long thread can run"
14
15
  + " to tens of thousands of characters and be truncated before you see any of it."
15
16
  + " [See the documentation](https://api.slack.com/methods/conversations.replies)",
16
- version: "0.1.0",
17
+ version: "0.1.2",
17
18
  type: "action",
18
19
  annotations: {
19
20
  destructiveHint: false,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
@@ -13,7 +14,7 @@ export default {
13
14
  + " Prefer this over **Get Current User**, which returns a much larger payload and is only"
14
15
  + " needed for full profile detail (locale, status, admin flags)."
15
16
  + " [See the documentation](https://api.slack.com/methods/auth.test)",
16
- version: "0.0.2",
17
+ version: "0.0.4",
17
18
  type: "action",
18
19
  annotations: {
19
20
  destructiveHint: false,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import { ConfigurationError } from "@pipedream/platform";
2
3
  import slack from "../../slack_v2.app.mjs";
3
4
 
@@ -5,7 +6,7 @@ export default {
5
6
  key: "slack_v2-invite-user-to-channel",
6
7
  name: "Invite User to Channel",
7
8
  description: "Invite one or more users to an existing channel. Accepts a channel ID or NAME, and a user ID, EMAIL address or display name — all resolved automatically. Pass several users as a comma-separated list. [See the documentation](https://api.slack.com/methods/conversations.invite)",
8
- version: "0.1.0",
9
+ version: "0.1.2",
9
10
  annotations: {
10
11
  destructiveHint: false,
11
12
  openWorldHint: true,
@@ -1,11 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
- import constants from "../../common/constants.mjs";
3
3
 
4
4
  export default {
5
5
  key: "slack_v2-kick-user",
6
6
  name: "Kick User",
7
7
  description: "Remove a user from a conversation. [See the documentation](https://api.slack.com/methods/conversations.kick)",
8
- version: "0.0.30",
8
+ version: "0.0.32",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -18,22 +18,12 @@ export default {
18
18
  propDefinition: [
19
19
  slack,
20
20
  "conversation",
21
- () => ({
22
- types: [
23
- constants.CHANNEL_TYPE.PUBLIC,
24
- constants.CHANNEL_TYPE.PRIVATE,
25
- constants.CHANNEL_TYPE.MPIM,
26
- ],
27
- }),
28
21
  ],
29
22
  },
30
23
  user: {
31
24
  propDefinition: [
32
25
  slack,
33
26
  "user",
34
- (c) => ({
35
- channelId: c.conversation,
36
- }),
37
27
  ],
38
28
  },
39
29
  },
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import utils from "../../common/utils.mjs";
2
3
  import slack from "../../slack_v2.app.mjs";
3
4
 
@@ -6,15 +7,16 @@ export default {
6
7
  name: "List Channels",
7
8
  description:
8
9
  "Return a list of channels in a workspace."
9
- + " **Always pass `fields`** with just the properties you need (e.g. `id,name`) —"
10
- + " a full channel object is ~1KB, so a workspace of any real size returns a payload"
11
- + " large enough to be truncated before you ever see it. `id,name` covers most tasks;"
12
- + " every other tool here accepts a channel NAME and resolves it, so you rarely need more."
10
+ + " Pass `fields` (e.g. `[\"id\",\"name\"]`) to limit the returned properties —"
11
+ + " a full channel object is ~1KB, so a workspace of any real size can return a payload"
12
+ + " large enough to be truncated. Omit `fields` when you need the complete channel objects."
13
+ + " Use `namePrefix` to filter results to channels whose names start with a given string"
14
+ + " (e.g. `dev-`) without a client-side filter loop."
13
15
  + " Returns `has_more: true` and `next_cursor` when more channels exist than were"
14
16
  + " fetched — when you see that, raise `numPages` (or pass `cursor`) before answering"
15
17
  + " any 'how many' or 'list every' question, otherwise your answer is silently incomplete."
16
18
  + " [See the documentation](https://api.slack.com/methods/conversations.list)",
17
- version: "0.2.0",
19
+ version: "0.3.0",
18
20
  annotations: {
19
21
  destructiveHint: false,
20
22
  openWorldHint: true,
@@ -26,7 +28,7 @@ export default {
26
28
  channelTypes: {
27
29
  type: "string",
28
30
  label: "Channel Types",
29
- description: "The types of channels to list. Select `public` for public channels only, `private` for private channels only, or `all` for both public and private channels.",
31
+ description: "Which channel types to list. Pass `public_channel` for public channels only, `private_channel` for private channels only, or `public_channel,private_channel` for both (default).",
30
32
  options: [
31
33
  {
32
34
  label: "Public Channels",
@@ -66,9 +68,15 @@ export default {
66
68
  ],
67
69
  },
68
70
  cursor: {
71
+ propDefinition: [
72
+ slack,
73
+ "cursor",
74
+ ],
75
+ },
76
+ namePrefix: {
69
77
  type: "string",
70
- label: "Cursor",
71
- description: "Resume from a previous call's `next_cursor` to fetch the following page.",
78
+ label: "Name Prefix",
79
+ description: "Return only channels whose names start with this prefix (case-insensitive). Example: `dev-`. When set, ALL pages are fetched regardless of `Number of Pages` so the filter is applied across the full workspace channel list.",
72
80
  optional: true,
73
81
  },
74
82
  },
@@ -85,15 +93,26 @@ export default {
85
93
  let page = 0;
86
94
  let nextCursor;
87
95
 
96
+ // namePrefix filters each page as it arrives (rather than accumulating the full
97
+ // workspace and filtering once at the end) so memory stays bounded by the match
98
+ // count, not the workspace size, on large workspaces.
99
+ const prefix = this.namePrefix?.toLowerCase();
100
+
88
101
  do {
89
102
  const {
90
103
  channels, response_metadata: metadata,
91
104
  } = await this.slack.conversationsList(params);
92
- allChannels.push(...channels);
105
+ const pageChannels = prefix
106
+ ? channels.filter((c) => c.name?.toLowerCase().startsWith(prefix))
107
+ : channels;
108
+ allChannels.push(...pageChannels);
93
109
  nextCursor = metadata?.next_cursor;
94
110
  params.cursor = nextCursor;
95
111
  page++;
96
- } while (params.cursor && page < this.numPages);
112
+ // When namePrefix is active, fetch ALL pages so the filter can be applied
113
+ // across the full workspace channel list — matching channels may live on
114
+ // any page and would be silently missing if capped at numPages.
115
+ } while (params.cursor && (this.namePrefix || page < this.numPages));
97
116
 
98
117
  // `fields` is ADDITIVE: omitted returns exactly what this action has always
99
118
  // returned, so existing workflows are unaffected. Supplied, it plucks per channel —
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
@@ -5,7 +6,7 @@ export default {
5
6
  name: "List Emojis",
6
7
  description:
7
8
  "List all available emojis in the Slack workspace. Optionally include emoji image URLs. [See the documentation](https://api.slack.com/methods/emoji.list)",
8
- version: "0.0.4",
9
+ version: "0.0.6",
9
10
  annotations: {
10
11
  destructiveHint: false,
11
12
  openWorldHint: true,
@@ -1,11 +1,11 @@
1
- import constants from "../../common/constants.mjs";
1
+ // x-pd-ai: optimized
2
2
  import slack from "../../slack_v2.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "slack_v2-list-files",
6
6
  name: "List Files",
7
7
  description: "Return a list of files within a team. [See the documentation](https://api.slack.com/methods/files.list)",
8
- version: "0.1.5",
8
+ version: "0.1.7",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -18,14 +18,7 @@ export default {
18
18
  propDefinition: [
19
19
  slack,
20
20
  "conversation",
21
- () => ({
22
- types: [
23
- constants.CHANNEL_TYPE.PUBLIC,
24
- constants.CHANNEL_TYPE.PRIVATE,
25
- ],
26
- }),
27
21
  ],
28
- description: "Select a public or private channel",
29
22
  },
30
23
  addToChannel: {
31
24
  propDefinition: [
@@ -61,15 +54,17 @@ export default {
61
54
  },
62
55
  },
63
56
  async run({ $ }) {
57
+ const channel = await this.slack.resolveChannelId(this.conversation);
58
+
64
59
  if (this.addToChannel) {
65
60
  await this.slack.maybeAddAppToChannels([
66
- this.conversation,
61
+ channel,
67
62
  ]);
68
63
  }
69
64
 
70
65
  const allFiles = [];
71
66
  const params = {
72
- channel: this.conversation,
67
+ channel,
73
68
  user: this.user,
74
69
  team_id: this.team_id,
75
70
  page: 1,
@@ -0,0 +1,86 @@
1
+ // x-pd-ai: optimized
2
+ import slack from "../../slack_v2.app.mjs";
3
+
4
+ export default {
5
+ key: "slack_v2-list-group-conversations",
6
+ name: "List Group Conversations",
7
+ description:
8
+ "Return a list of multi-person direct message (group DM) conversations the connected"
9
+ + " account is a member of. Use the returned `id` (e.g. `G1234567890`) wherever a Group"
10
+ + " conversation ID is required."
11
+ + " Returns `has_more: true` and `next_cursor` when more conversations exist than were"
12
+ + " fetched — raise `numPages` (or pass `cursor`) to see the rest."
13
+ + " [See the documentation](https://api.slack.com/methods/conversations.list)",
14
+ version: "0.0.1",
15
+ annotations: {
16
+ destructiveHint: false,
17
+ openWorldHint: true,
18
+ readOnlyHint: true,
19
+ },
20
+ type: "action",
21
+ props: {
22
+ slack,
23
+ pageSize: {
24
+ propDefinition: [
25
+ slack,
26
+ "pageSize",
27
+ ],
28
+ },
29
+ numPages: {
30
+ propDefinition: [
31
+ slack,
32
+ "numPages",
33
+ ],
34
+ },
35
+ cursor: {
36
+ propDefinition: [
37
+ slack,
38
+ "cursor",
39
+ ],
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const groups = [];
44
+ const params = {
45
+ types: "mpim",
46
+ limit: this.pageSize,
47
+ cursor: this.cursor,
48
+ };
49
+ let page = 0;
50
+ let nextCursor;
51
+
52
+ do {
53
+ const {
54
+ channels, response_metadata: metadata,
55
+ } = await this.slack.conversationsList(params);
56
+ groups.push(...channels.map(({
57
+ id, purpose, is_archived: isArchived,
58
+ }) => ({
59
+ id,
60
+ purpose: purpose?.value,
61
+ is_archived: isArchived,
62
+ })));
63
+ nextCursor = metadata?.next_cursor;
64
+ params.cursor = nextCursor;
65
+ page++;
66
+ } while (params.cursor && page < this.numPages);
67
+
68
+ const hasMore = Boolean(nextCursor);
69
+
70
+ $.export("$summary", `Successfully found ${groups.length} group conversation${groups.length === 1
71
+ ? ""
72
+ : "s"}${hasMore
73
+ ? " (more available — raise Number of Pages or pass the cursor)"
74
+ : ""}`);
75
+
76
+ return {
77
+ groups,
78
+ has_more: hasMore,
79
+ ...(hasMore
80
+ ? {
81
+ next_cursor: nextCursor,
82
+ }
83
+ : {}),
84
+ };
85
+ },
86
+ };
@@ -1,10 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-list-group-members",
5
6
  name: "List Group Members",
6
7
  description: "List all users in a User Group. [See the documentation](https://api.slack.com/methods/usergroups.users.list)",
7
- version: "0.0.14",
8
+ version: "0.0.16",
8
9
  annotations: {
9
10
  destructiveHint: false,
10
11
  openWorldHint: true,
@@ -25,7 +26,7 @@ export default {
25
26
  "team",
26
27
  ],
27
28
  optional: true,
28
- description: "Encoded team id where the user group exists, required if org token is used.",
29
+ description: "The encoded team ID (e.g. `T1234567890`) where the user group exists. Required only if the connected token spans multiple teams (Enterprise Grid). Use **List Teams** to find valid IDs.",
29
30
  },
30
31
  pageSize: {
31
32
  propDefinition: [
@@ -1,10 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack_v2 from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-list-icon-emoji-options",
5
6
  name: "List Icon (emoji) Options",
6
- description: "Retrieves available options for the Icon (emoji) field.",
7
- version: "0.0.2",
7
+ description: "Retrieves available options for the Icon (emoji) field. [See the documentation](https://api.slack.com/methods/emoji.list)",
8
+ version: "0.0.4",
8
9
  type: "action",
9
10
  annotations: {
10
11
  destructiveHint: false,
@@ -15,7 +16,9 @@ export default {
15
16
  slack_v2,
16
17
  },
17
18
  async run({ $ }) {
18
- const options = await slack_v2.propDefinitions.icon_emoji.options.call(this.slack_v2);
19
+ const options = await this.slack_v2.getCustomEmojis({
20
+ throwRateLimitError: true,
21
+ });
19
22
  $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1
20
23
  ? ""
21
24
  : "s"}`);
@@ -1,10 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-list-members-in-channel",
5
6
  name: "List Members in Channel",
6
7
  description: "Retrieve members of a channel. Accepts a channel ID or NAME (e.g. general or #general) — names are resolved automatically. [See the documentation](https://api.slack.com/methods/conversations.members)",
7
- version: "0.1.0",
8
+ version: "0.1.2",
8
9
  annotations: {
9
10
  destructiveHint: false,
10
11
  openWorldHint: true,
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import slack from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-list-messages",
5
- name: "List Messages",
6
+ name: "List Messages (Deprecated)",
6
7
  description:
7
- "Retrieve messages from a Slack conversation, including reactions. [See the documentation](https://api.slack.com/methods/conversations.history)",
8
- version: "0.0.5",
8
+ "DEPRECATED do NOT use for reading a channel's or DM's messages. Use **Get Channel History** instead:"
9
+ + " it resolves channel names, channel IDs, and direct messages (by user ID), supports `fields`"
10
+ + " selection to keep responses small, and returns the same message data."
11
+ + " This legacy tool remains only for existing workflows: it accepts a raw conversation ID and"
12
+ + " returns full, untrimmed message objects. [See the documentation](https://api.slack.com/methods/conversations.history)",
13
+ version: "0.0.7",
9
14
  annotations: {
10
15
  destructiveHint: false,
11
16
  openWorldHint: true,
@@ -1,10 +1,11 @@
1
+ // x-pd-ai: optimized
1
2
  import slack_v2 from "../../slack_v2.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "slack_v2-list-reminder-options",
5
6
  name: "List Reminder Options",
6
- description: "Retrieves available options for the Reminder field.",
7
- version: "0.0.2",
7
+ description: "Retrieves available options for the Reminder field. [See the documentation](https://docs.slack.dev/reference/methods/reminders.list)",
8
+ version: "0.0.4",
8
9
  type: "action",
9
10
  annotations: {
10
11
  destructiveHint: false,
@@ -15,7 +16,13 @@ export default {
15
16
  slack_v2,
16
17
  },
17
18
  async run({ $ }) {
18
- const options = await slack_v2.propDefinitions.reminder.options.call(this.slack_v2);
19
+ const { reminders } = await this.slack_v2.remindersList({
20
+ throwRateLimitError: true,
21
+ });
22
+ const options = reminders.map((r) => ({
23
+ label: r.text,
24
+ value: r.id,
25
+ }));
19
26
  $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1
20
27
  ? ""
21
28
  : "s"}`);
@@ -1,11 +1,11 @@
1
- import constants from "../../common/constants.mjs";
1
+ // x-pd-ai: optimized
2
2
  import slack from "../../slack_v2.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "slack_v2-list-replies",
6
6
  name: "List Replies",
7
7
  description: "Retrieve a thread of messages posted to a conversation. [See the documentation](https://api.slack.com/methods/conversations.replies)",
8
- version: "0.0.30",
8
+ version: "0.0.32",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -18,14 +18,7 @@ export default {
18
18
  propDefinition: [
19
19
  slack,
20
20
  "conversation",
21
- () => ({
22
- types: [
23
- constants.CHANNEL_TYPE.PUBLIC,
24
- constants.CHANNEL_TYPE.PRIVATE,
25
- ],
26
- }),
27
21
  ],
28
- description: "Select a public or private channel",
29
22
  },
30
23
  timestamp: {
31
24
  propDefinition: [
@@ -0,0 +1,88 @@
1
+ // x-pd-ai: optimized
2
+ import slack from "../../slack_v2.app.mjs";
3
+
4
+ export default {
5
+ key: "slack_v2-list-teams",
6
+ name: "List Teams",
7
+ description:
8
+ "Return the full list of teams (workspaces) accessible to the connected account,"
9
+ + " with pagination (`has_more`/`next_cursor`) so you know whether there could be more"
10
+ + " than what came back. Use this — not **Get User Details** or **Get Current User**, which"
11
+ + " only ever describe the caller's single current team — whenever the task asks to"
12
+ + " enumerate, count, or check for multiple teams/workspaces, especially on an"
13
+ + " Enterprise Grid org-wide token. Use the returned `id` (e.g. `T1234567890`)"
14
+ + " wherever a Team ID is required."
15
+ + " Returns `has_more: true` and `next_cursor` when more teams exist than were"
16
+ + " fetched — raise `numPages` (or pass `cursor`) to see the rest."
17
+ + " [See the documentation](https://api.slack.com/methods/auth.teams.list)",
18
+ version: "0.0.1",
19
+ annotations: {
20
+ destructiveHint: false,
21
+ openWorldHint: true,
22
+ readOnlyHint: true,
23
+ },
24
+ type: "action",
25
+ props: {
26
+ slack,
27
+ pageSize: {
28
+ propDefinition: [
29
+ slack,
30
+ "pageSize",
31
+ ],
32
+ },
33
+ numPages: {
34
+ propDefinition: [
35
+ slack,
36
+ "numPages",
37
+ ],
38
+ },
39
+ cursor: {
40
+ propDefinition: [
41
+ slack,
42
+ "cursor",
43
+ ],
44
+ },
45
+ },
46
+ async run({ $ }) {
47
+ const teams = [];
48
+ const params = {
49
+ limit: this.pageSize,
50
+ cursor: this.cursor,
51
+ };
52
+ let page = 0;
53
+ let nextCursor;
54
+
55
+ do {
56
+ const {
57
+ teams: fetched, response_metadata: metadata,
58
+ } = await this.slack.authTeamsList(params);
59
+ teams.push(...fetched.map(({
60
+ id, name,
61
+ }) => ({
62
+ id,
63
+ name,
64
+ })));
65
+ nextCursor = metadata?.next_cursor;
66
+ params.cursor = nextCursor;
67
+ page++;
68
+ } while (params.cursor && page < this.numPages);
69
+
70
+ const hasMore = Boolean(nextCursor);
71
+
72
+ $.export("$summary", `Successfully found ${teams.length} team${teams.length === 1
73
+ ? ""
74
+ : "s"}${hasMore
75
+ ? " (more available — raise Number of Pages or pass the cursor)"
76
+ : ""}`);
77
+
78
+ return {
79
+ teams,
80
+ has_more: hasMore,
81
+ ...(hasMore
82
+ ? {
83
+ next_cursor: nextCursor,
84
+ }
85
+ : {}),
86
+ };
87
+ },
88
+ };