@pipedream/slack_v2 1.1.4 → 1.2.5
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.
|
@@ -11,11 +11,14 @@ export default {
|
|
|
11
11
|
+ " large enough to be truncated. Omit `fields` when you need the complete channel objects."
|
|
12
12
|
+ " Use `namePrefix` to filter results to channels whose names start with a given string"
|
|
13
13
|
+ " (e.g. `dev-`) without a client-side filter loop."
|
|
14
|
+
+ " Set `memberOnly: true` to return only channels the authenticated user is a member of —"
|
|
15
|
+
+ " on a large workspace this shrinks the result from thousands of channels to the"
|
|
16
|
+
+ " handful that matter, and it is usually what you want when acting on the user's behalf."
|
|
14
17
|
+ " Returns `has_more: true` and `next_cursor` when more channels exist than were"
|
|
15
18
|
+ " fetched — when you see that, raise `numPages` (or pass `cursor`) before answering"
|
|
16
19
|
+ " any 'how many' or 'list every' question, otherwise your answer is silently incomplete."
|
|
17
20
|
+ " [See the documentation](https://api.slack.com/methods/conversations.list)",
|
|
18
|
-
version: "0.
|
|
21
|
+
version: "0.4.0",
|
|
19
22
|
annotations: {
|
|
20
23
|
destructiveHint: false,
|
|
21
24
|
openWorldHint: true,
|
|
@@ -46,6 +49,13 @@ export default {
|
|
|
46
49
|
default: "public_channel",
|
|
47
50
|
optional: true,
|
|
48
51
|
},
|
|
52
|
+
memberOnly: {
|
|
53
|
+
type: "boolean",
|
|
54
|
+
label: "Member Channels Only",
|
|
55
|
+
description: "Return only channels the authenticated user is a member of (uses `users.conversations` instead of `conversations.list`). Recommended for large workspaces: the full channel list can run to thousands of entries, while the user's own channels are usually a small fraction of that. `Channel Types`, `Fields`, `Name Prefix`, and pagination all still apply.",
|
|
56
|
+
optional: true,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
49
59
|
fields: {
|
|
50
60
|
type: "string[]",
|
|
51
61
|
label: "Fields",
|
|
@@ -98,10 +108,17 @@ export default {
|
|
|
98
108
|
// count, not the workspace size, on large workspaces.
|
|
99
109
|
const prefix = this.namePrefix?.toLowerCase();
|
|
100
110
|
|
|
111
|
+
// users.conversations returns the same shape as conversations.list (channels +
|
|
112
|
+
// response_metadata.next_cursor) but scoped to the authed user's memberships, so
|
|
113
|
+
// the pagination / filter / projection logic below is shared between both modes.
|
|
114
|
+
const listChannels = this.memberOnly
|
|
115
|
+
? (args) => this.slack.usersConversations(args)
|
|
116
|
+
: (args) => this.slack.conversationsList(args);
|
|
117
|
+
|
|
101
118
|
do {
|
|
102
119
|
const {
|
|
103
120
|
channels, response_metadata: metadata,
|
|
104
|
-
} = await
|
|
121
|
+
} = await listChannels(params);
|
|
105
122
|
const pageChannels = prefix
|
|
106
123
|
? channels.filter((c) => c.name?.toLowerCase().startsWith(prefix))
|
|
107
124
|
: channels;
|
|
@@ -10,8 +10,9 @@ export default {
|
|
|
10
10
|
+ " To post a note to yourself (save a personal note or reminder), pass your own user ID (e.g. `U1234567890`) as the Channel — use **Get Current User** to find your user ID first."
|
|
11
11
|
+ " To reply to a thread, provide `threadTs` (Slack calls this `thread_ts`) from **Get Channel History**."
|
|
12
12
|
+ " Supports plain text with Slack mrkdwn formatting and Block Kit blocks."
|
|
13
|
+
+ " Posts as the authenticated user by default; set `sendAsBot` to `true` to post as the Slack app's bot user instead."
|
|
13
14
|
+ " [See the documentation](https://api.slack.com/methods/chat.postMessage)",
|
|
14
|
-
version: "0.0
|
|
15
|
+
version: "0.1.0",
|
|
15
16
|
type: "action",
|
|
16
17
|
ai: "optimized",
|
|
17
18
|
annotations: {
|
|
@@ -71,6 +72,13 @@ export default {
|
|
|
71
72
|
default: true,
|
|
72
73
|
optional: true,
|
|
73
74
|
},
|
|
75
|
+
sendAsBot: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
label: "Send as Bot",
|
|
78
|
+
description: "Set to `true` to post the message as the Slack app's bot user instead of the authenticated user. The app is added to the channel automatically if it is not already a member (not possible for DMs). The bot cannot DM a user who has not opened its Messages tab. Defaults to `false` (posts as the authenticated user).",
|
|
79
|
+
default: false,
|
|
80
|
+
optional: true,
|
|
81
|
+
},
|
|
74
82
|
},
|
|
75
83
|
async run({ $ }) {
|
|
76
84
|
// chat.postMessage accepts channel names directly — no ID resolution needed
|
|
@@ -93,6 +101,20 @@ export default {
|
|
|
93
101
|
args.thread_ts = this.threadTs;
|
|
94
102
|
args.reply_broadcast = this.replyBroadcast;
|
|
95
103
|
}
|
|
104
|
+
// as_user: false routes the request through the bot token (see makeRequest).
|
|
105
|
+
// Omitting it keeps the default: post as the authenticated user.
|
|
106
|
+
if (this.sendAsBot) {
|
|
107
|
+
// conversations.invite needs a channel ID, so resolve names first. Skip user IDs:
|
|
108
|
+
// the app can't be added to a DM, and chat.postMessage opens the bot DM itself.
|
|
109
|
+
if (!/^[UW][A-Z0-9]{8,}$/.test(channel)) {
|
|
110
|
+
const channelId = await this.slack.resolveChannelId(channel);
|
|
111
|
+
await this.slack.maybeAddAppToChannels([
|
|
112
|
+
channelId,
|
|
113
|
+
]);
|
|
114
|
+
args.channel = channelId;
|
|
115
|
+
}
|
|
116
|
+
args.as_user = false;
|
|
117
|
+
}
|
|
96
118
|
const response = await this.slack.postChatMessage(args);
|
|
97
119
|
let permalink;
|
|
98
120
|
try {
|