@pipedream/slack_v2 0.6.0 → 0.6.1
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.
- package/actions/add-emoji-reaction/add-emoji-reaction.mjs +1 -1
- package/actions/approve-workflow/approve-workflow.mjs +1 -1
- package/actions/archive-channel/archive-channel.mjs +1 -1
- package/actions/create-reminder/create-reminder.mjs +1 -1
- package/actions/delete-file/delete-file.mjs +1 -1
- package/actions/delete-message/delete-message.mjs +1 -1
- package/actions/find-user-by-id/find-user-by-id.mjs +1 -1
- package/actions/get-channel-details/get-channel-details.mjs +1 -1
- package/actions/get-file/get-file.mjs +1 -1
- package/actions/invite-user-to-channel/invite-user-to-channel.mjs +1 -1
- package/actions/kick-user/kick-user.mjs +1 -1
- package/actions/list-files/list-files.mjs +1 -1
- package/actions/list-members-in-channel/list-members-in-channel.mjs +3 -3
- package/actions/list-messages/list-messages.mjs +1 -1
- package/actions/list-replies/list-replies.mjs +1 -1
- package/actions/reply-to-a-message/reply-to-a-message.mjs +1 -1
- package/actions/send-block-kit-message/send-block-kit-message.mjs +1 -1
- package/actions/send-large-message/send-large-message.mjs +1 -1
- package/actions/send-message/send-message.mjs +1 -1
- package/actions/send-message-advanced/send-message-advanced.mjs +1 -1
- package/actions/send-message-to-channel/send-message-to-channel.mjs +1 -1
- package/actions/send-message-to-user-or-group/send-message-to-user-or-group.mjs +1 -1
- package/actions/set-channel-description/set-channel-description.mjs +1 -1
- package/actions/set-channel-topic/set-channel-topic.mjs +1 -1
- package/actions/update-group-members/update-group-members.mjs +1 -1
- package/actions/update-message/update-message.mjs +1 -1
- package/actions/update-profile/update-profile.mjs +1 -1
- package/actions/upload-file/upload-file.mjs +1 -1
- package/common/constants.mjs +5 -0
- package/package.json +1 -1
- package/slack_v2.app.mjs +89 -21
- package/sources/new-interaction-event-received/new-interaction-event-received.mjs +1 -1
- package/sources/new-keyword-mention/new-keyword-mention.mjs +1 -1
- package/sources/new-message-in-channels/new-message-in-channels.mjs +1 -1
- package/sources/new-reaction-added/new-reaction-added.mjs +1 -1
- package/sources/new-user-mention/new-user-mention.mjs +1 -1
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-add-emoji-reaction",
|
|
5
5
|
name: "Add Emoji Reaction",
|
|
6
6
|
description: "Add an emoji reaction to a message. [See the documentation](https://api.slack.com/methods/reactions.add)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.21",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "slack_v2-approve-workflow",
|
|
6
6
|
name: "Approve Workflow",
|
|
7
7
|
description: "Suspend the workflow until approved by a Slack message. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "slack_v2-archive-channel",
|
|
6
6
|
name: "Archive Channel",
|
|
7
7
|
description: "Archive a channel. [See the documentation](https://api.slack.com/methods/conversations.archive)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.29",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-create-reminder",
|
|
5
5
|
name: "Create Reminder",
|
|
6
6
|
description: "Create a reminder. [See the documentation](https://api.slack.com/methods/reminders.add)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.30",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-delete-file",
|
|
5
5
|
name: "Delete File",
|
|
6
6
|
description: "Delete a file. [See the documentation](https://api.slack.com/methods/files.delete)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.29",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: true,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-delete-message",
|
|
5
5
|
name: "Delete Message",
|
|
6
6
|
description: "Delete a message. [See the documentation](https://api.slack.com/methods/chat.delete)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.4",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: true,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-find-user-by-id",
|
|
5
5
|
name: "Find User by ID",
|
|
6
6
|
description: "Find a user by their ID. Returns user profile information including name, email (requires `users:read.email` scope), timezone, and status. [See the documentation](https://api.slack.com/methods/users.info)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-get-channel-details",
|
|
5
5
|
name: "Get Channel Details",
|
|
6
6
|
description: "Retrieve details for a Slack channel by selecting it or providing an ID. [See the documentation](https://api.slack.com/methods/conversations.info)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -5,7 +5,7 @@ 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.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-invite-user-to-channel",
|
|
5
5
|
name: "Invite User to Channel",
|
|
6
6
|
description: "Invite a user to an existing channel. [See the documentation](https://api.slack.com/methods/conversations.invite)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.29",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ 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.
|
|
8
|
+
version: "0.0.29",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ 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.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-list-members-in-channel",
|
|
5
5
|
name: "List Members in Channel",
|
|
6
6
|
description: "Retrieve members of a channel. [See the documentation](https://api.slack.com/methods/conversations.members)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.29",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
returnUsernames: {
|
|
23
23
|
type: "boolean",
|
|
24
24
|
label: "Return Usernames",
|
|
25
|
-
description: "Optionally, return usernames in addition to IDs",
|
|
25
|
+
description: "Optionally, return usernames in addition to IDs. The username may be `null` for members whose name cannot be resolved, such as external (Slack Connect) users.",
|
|
26
26
|
optional: true,
|
|
27
27
|
},
|
|
28
28
|
pageSize: {
|
|
@@ -59,7 +59,7 @@ export default {
|
|
|
59
59
|
const usernames = await this.slack.userNameLookup(channelMembers);
|
|
60
60
|
channelMembers = channelMembers?.map((id) => ({
|
|
61
61
|
id,
|
|
62
|
-
username: usernames[id],
|
|
62
|
+
username: usernames[id] ?? null,
|
|
63
63
|
})) || [];
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "List Messages",
|
|
6
6
|
description:
|
|
7
7
|
"Retrieve messages from a Slack conversation, including reactions. [See the documentation](https://api.slack.com/methods/conversations.history)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.4",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ 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.
|
|
8
|
+
version: "0.0.29",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "slack_v2-reply-to-a-message",
|
|
7
7
|
name: "Reply to a Message Thread",
|
|
8
8
|
description: "Send a message as a threaded reply. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
|
|
9
|
-
version: "0.2.
|
|
9
|
+
version: "0.2.4",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
12
12
|
openWorldHint: true,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "slack_v2-send-block-kit-message",
|
|
8
8
|
name: "Build and Send a Block Kit Message",
|
|
9
9
|
description: "Configure custom blocks and send to a channel, group, or user. [See the documentation](https://api.slack.com/tools/block-kit-builder).",
|
|
10
|
-
version: "0.5.
|
|
10
|
+
version: "0.5.4",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
13
13
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "slack_v2-send-large-message",
|
|
6
6
|
name: "Send a Large Message (3000+ characters)",
|
|
7
7
|
description: "Send a large message (more than 3000 characters) to a channel, group or user. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "slack_v2-send-message",
|
|
7
7
|
name: "Send Message",
|
|
8
8
|
description: "Send a message to a user, group, private channel or public channel. [See the documentation](https://api.slack.com/methods/chat.postMessage)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.4",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
12
12
|
openWorldHint: true,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "slack_v2-send-message-advanced",
|
|
8
8
|
name: "Send Message (Advanced)",
|
|
9
9
|
description: "Customize advanced settings and send a message to a channel, group or user. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.4",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
13
13
|
openWorldHint: true,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "slack_v2-send-message-to-channel",
|
|
7
7
|
name: "Send Message to Channel",
|
|
8
8
|
description: "Send a message to a public or private channel. [See the documentation](https://api.slack.com/methods/chat.postMessage)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.4",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
12
12
|
openWorldHint: true,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "slack_v2-send-message-to-user-or-group",
|
|
8
8
|
name: "Send Message to User or Group",
|
|
9
9
|
description: "Send a message to a user or group. [See the documentation](https://api.slack.com/methods/chat.postMessage)",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.4",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
13
13
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-set-channel-description",
|
|
5
5
|
name: "Set Channel Description",
|
|
6
6
|
description: "Change the description or purpose of a channel. [See the documentation](https://api.slack.com/methods/conversations.setPurpose)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.14",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-set-channel-topic",
|
|
5
5
|
name: "Set Channel Topic",
|
|
6
6
|
description: "Set the topic on a selected channel. [See the documentation](https://api.slack.com/methods/conversations.setTopic)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.29",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: true,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-update-group-members",
|
|
5
5
|
name: "Update Group Members",
|
|
6
6
|
description: "Update the list of users for a User Group. [See the documentation](https://api.slack.com/methods/usergroups.users.update)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.14",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: true,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack_v2-update-message",
|
|
5
5
|
name: "Update Message",
|
|
6
6
|
description: "Update a message. [See the documentation](https://api.slack.com/methods/chat.update)",
|
|
7
|
-
version: "0.2.
|
|
7
|
+
version: "0.2.4",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: true,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "slack_v2-update-profile",
|
|
6
6
|
name: "Update Profile",
|
|
7
7
|
description: "Update basic profile field such as name or title. [See the documentation](https://api.slack.com/methods/users.profile.set)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.29",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "slack_v2-upload-file",
|
|
9
9
|
name: "Upload File",
|
|
10
10
|
description: "Upload a file. [See the documentation](https://api.slack.com/messaging/files#uploading_files)",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.8",
|
|
12
12
|
annotations: {
|
|
13
13
|
destructiveHint: false,
|
|
14
14
|
openWorldHint: true,
|
package/common/constants.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const MAX_RESOURCES = 800;
|
|
2
2
|
const LIMIT = 250;
|
|
3
|
+
// Caps `users.list` pagination in name lookups, since unresolvable ids (e.g.
|
|
4
|
+
// external Slack Connect users) would otherwise force a full directory scan
|
|
5
|
+
// and exhaust the method's rate limit.
|
|
6
|
+
const MAX_NAME_LOOKUP_PAGES = 5;
|
|
3
7
|
|
|
4
8
|
const CHANNEL_TYPE = {
|
|
5
9
|
PUBLIC: "public_channel",
|
|
@@ -26,6 +30,7 @@ const CHANNEL_TYPE_OPTIONS = [
|
|
|
26
30
|
export default {
|
|
27
31
|
MAX_RESOURCES,
|
|
28
32
|
LIMIT,
|
|
33
|
+
MAX_NAME_LOOKUP_PAGES,
|
|
29
34
|
CHANNEL_TYPE,
|
|
30
35
|
CHANNEL_TYPE_OPTIONS,
|
|
31
36
|
};
|
package/package.json
CHANGED
package/slack_v2.app.mjs
CHANGED
|
@@ -11,32 +11,82 @@ export default {
|
|
|
11
11
|
user: {
|
|
12
12
|
type: "string",
|
|
13
13
|
label: "User",
|
|
14
|
-
description: "Select a user",
|
|
14
|
+
description: "Select a user, or search by name or email",
|
|
15
|
+
useQuery: true,
|
|
15
16
|
async options({
|
|
16
|
-
prevContext, channelId,
|
|
17
|
+
prevContext, channelId, query,
|
|
17
18
|
}) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
let nameQuery = query
|
|
20
|
+
?.trim()
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/^@/, "");
|
|
23
|
+
if (/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(nameQuery ?? "")) {
|
|
24
|
+
try {
|
|
25
|
+
const { user } = await this.lookupUserByEmail({
|
|
26
|
+
email: nameQuery,
|
|
27
|
+
throwRateLimitError: true,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
options: [
|
|
31
|
+
{
|
|
32
|
+
label: user.profile?.real_name || user.name,
|
|
33
|
+
value: user.id,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
} catch {
|
|
38
|
+
// Token may lack `users:read.email`, or no member has this email.
|
|
39
|
+
// Fall back to matching names below with the email's local part.
|
|
40
|
+
nameQuery = nameQuery.split("@")[0].replace(/[._-]+/g, " ");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let channelMembers;
|
|
23
44
|
if (channelId) {
|
|
24
45
|
const { members } = await this.listChannelMembers({
|
|
25
46
|
channel: channelId,
|
|
26
47
|
throwRateLimitError: true,
|
|
27
48
|
});
|
|
28
|
-
|
|
29
|
-
.filter((c) => members.includes(c.user || c.id));
|
|
49
|
+
channelMembers = new Set(members);
|
|
30
50
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
51
|
+
const options = [];
|
|
52
|
+
let cursor = prevContext?.cursor;
|
|
53
|
+
let pages = 0;
|
|
54
|
+
do {
|
|
55
|
+
const {
|
|
56
|
+
members,
|
|
57
|
+
response_metadata: { next_cursor: nextCursor },
|
|
58
|
+
} = await this.usersList({
|
|
59
|
+
limit: constants.LIMIT,
|
|
60
|
+
cursor,
|
|
61
|
+
throwRateLimitError: true,
|
|
62
|
+
});
|
|
63
|
+
for (const member of members) {
|
|
64
|
+
const isSelectable = !member.deleted
|
|
65
|
+
&& !member.is_bot
|
|
66
|
+
&& member.id !== "USLACKBOT"
|
|
67
|
+
&& (!channelMembers || channelMembers.has(member.id));
|
|
68
|
+
if (isSelectable) {
|
|
69
|
+
const names = [
|
|
70
|
+
member.profile?.real_name,
|
|
71
|
+
member.profile?.display_name,
|
|
72
|
+
member.name,
|
|
73
|
+
];
|
|
74
|
+
if (!nameQuery || names.some((name) => name?.toLowerCase().includes(nameQuery))) {
|
|
75
|
+
options.push({
|
|
76
|
+
label: names.find(Boolean) ?? member.id,
|
|
77
|
+
value: member.id,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
cursor = nextCursor;
|
|
83
|
+
} while (cursor
|
|
84
|
+
&& options.length < constants.LIMIT
|
|
85
|
+
&& ++pages < constants.MAX_NAME_LOOKUP_PAGES);
|
|
33
86
|
return {
|
|
34
|
-
options
|
|
35
|
-
label: `${realNames[c.user]}`,
|
|
36
|
-
value: c.user || c.id,
|
|
37
|
-
})),
|
|
87
|
+
options,
|
|
38
88
|
context: {
|
|
39
|
-
cursor
|
|
89
|
+
cursor,
|
|
40
90
|
},
|
|
41
91
|
};
|
|
42
92
|
},
|
|
@@ -146,12 +196,12 @@ export default {
|
|
|
146
196
|
options: conversations.map((c) => {
|
|
147
197
|
if (c.is_im) {
|
|
148
198
|
return {
|
|
149
|
-
label: `Direct messaging with: ${realNames[c.user]}`,
|
|
199
|
+
label: `Direct messaging with: ${realNames?.[c.user] ?? c.user}`,
|
|
150
200
|
value: c.id,
|
|
151
201
|
};
|
|
152
202
|
} else if (c.is_mpim) {
|
|
153
203
|
const usernames = c.purpose.value.match(/@[\w.-]+/g) || [];
|
|
154
|
-
const realnames = usernames.map((u) => realNames[u.slice(1)] || u);
|
|
204
|
+
const realnames = usernames.map((u) => realNames?.[u.slice(1)] || u);
|
|
155
205
|
return {
|
|
156
206
|
label: realnames.length
|
|
157
207
|
? `Group messaging with: ${realnames.join(", ")}`
|
|
@@ -205,8 +255,11 @@ export default {
|
|
|
205
255
|
.filter(channelsFilter)
|
|
206
256
|
.map((c) => {
|
|
207
257
|
if (c.is_im) {
|
|
258
|
+
const userName = userNames?.[c.user];
|
|
208
259
|
return {
|
|
209
|
-
label: `Direct messaging with:
|
|
260
|
+
label: `Direct messaging with: ${userName
|
|
261
|
+
? `@${userName}`
|
|
262
|
+
: c.user}`,
|
|
210
263
|
value: c.id,
|
|
211
264
|
};
|
|
212
265
|
} else if (c.is_mpim) {
|
|
@@ -626,8 +679,13 @@ export default {
|
|
|
626
679
|
conversations,
|
|
627
680
|
};
|
|
628
681
|
},
|
|
682
|
+
// Resolves user names by scanning `users.list`, capped at
|
|
683
|
+
// MAX_NAME_LOOKUP_PAGES pages per call: some ids may be unresolvable
|
|
684
|
+
// (e.g. external Slack Connect users), so callers must handle missing
|
|
685
|
+
// entries in the result.
|
|
629
686
|
async userNameLookup(ids = [], throwRateLimitError = true, args = {}) {
|
|
630
687
|
let cursor;
|
|
688
|
+
let pages = 0;
|
|
631
689
|
const userNames = {};
|
|
632
690
|
do {
|
|
633
691
|
const {
|
|
@@ -647,13 +705,21 @@ export default {
|
|
|
647
705
|
}
|
|
648
706
|
|
|
649
707
|
cursor = nextCursor;
|
|
650
|
-
} while (cursor
|
|
708
|
+
} while (cursor
|
|
709
|
+
&& ++pages < constants.MAX_NAME_LOOKUP_PAGES
|
|
710
|
+
&& Object.keys(userNames).length < ids.length);
|
|
651
711
|
return userNames;
|
|
652
712
|
},
|
|
713
|
+
// Resolves real names by scanning `users.list`, capped at
|
|
714
|
+
// MAX_NAME_LOOKUP_PAGES pages per call: some ids/usernames may be
|
|
715
|
+
// unresolvable (e.g. external Slack Connect users, or stale usernames in
|
|
716
|
+
// mpim purpose text), so callers must handle missing entries in the
|
|
717
|
+
// result.
|
|
653
718
|
async realNameLookup(ids = [], usernames = [], throwRateLimitError = true, args = {}) {
|
|
654
719
|
const idSet = new Set(ids);
|
|
655
720
|
const usernameSet = new Set(usernames);
|
|
656
721
|
let cursor;
|
|
722
|
+
let pages = 0;
|
|
657
723
|
const realNames = {};
|
|
658
724
|
const targetCount = ids.length + usernames.length;
|
|
659
725
|
do {
|
|
@@ -677,7 +743,9 @@ export default {
|
|
|
677
743
|
}
|
|
678
744
|
|
|
679
745
|
cursor = nextCursor;
|
|
680
|
-
} while (cursor
|
|
746
|
+
} while (cursor
|
|
747
|
+
&& ++pages < constants.MAX_NAME_LOOKUP_PAGES
|
|
748
|
+
&& Object.keys(realNames).length < targetCount);
|
|
681
749
|
return realNames;
|
|
682
750
|
},
|
|
683
751
|
async maybeAddAppToChannels(channelIds = []) {
|
|
@@ -3,7 +3,7 @@ import sampleEmit from "./test-event.mjs";
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: "New Interaction Events (Instant)",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.25",
|
|
7
7
|
key: "slack_v2-new-interaction-event-received",
|
|
8
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",
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
...common,
|
|
8
8
|
key: "slack_v2-new-keyword-mention",
|
|
9
9
|
name: "New Keyword Mention (Instant)",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.4",
|
|
11
11
|
description: "Emit new event when a specific keyword is mentioned in a channel",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
...common,
|
|
8
8
|
key: "slack_v2-new-message-in-channels",
|
|
9
9
|
name: "New Message In Channels (Instant)",
|
|
10
|
-
version: "1.1.
|
|
10
|
+
version: "1.1.4",
|
|
11
11
|
description: "Emit new event when a new message is posted to one or more channels",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
...common,
|
|
6
6
|
key: "slack_v2-new-reaction-added",
|
|
7
7
|
name: "New Reaction Added (Instant)",
|
|
8
|
-
version: "1.2.
|
|
8
|
+
version: "1.2.4",
|
|
9
9
|
description: "Emit new event when a member has added an emoji reaction to a message",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
...common,
|
|
8
8
|
key: "slack_v2-new-user-mention",
|
|
9
9
|
name: "New User Mention (Instant)",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.4",
|
|
11
11
|
description: "Emit new event when a username or specific keyword is mentioned in a channel",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|