Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e68de1f
Update Slack actions to support Slack v2 OAuth
js07 Oct 13, 2025
2f2719a
pass through as_user unless false and a bot token is available
js07 Oct 13, 2025
e5597ae
refactor: simplify special case handling of API error
js07 Oct 13, 2025
3aa0773
make addToChannel required for Send Message actions
js07 Oct 13, 2025
2126d8e
don't throw error when adding app to channels fails
js07 Oct 13, 2025
8eb39ec
delete New Direct Message trigger
js07 Oct 13, 2025
ce6dba8
delete the Verify Slack Signature action
js07 Oct 13, 2025
8b99a4e
Use assistant search API in Find Message action
js07 Oct 13, 2025
2476e2c
Support configuring base URL for Slack API requests
js07 Oct 13, 2025
074b23e
update pnpm-lock.yaml
js07 Oct 13, 2025
ccc2353
minor refactor of bot token usage
js07 Oct 13, 2025
8717ff3
Bump version numbers for Slack components to reflect recent updates
js07 Oct 13, 2025
325a164
bump Slack app minor version
js07 Oct 13, 2025
18a1e8f
Merge branch 'master' into slack-v2-support
js07 Oct 14, 2025
2df5de6
address review feedback
js07 Oct 16, 2025
42e6bb2
create Slack v2 app and components from Slack v1
js07 Oct 19, 2025
2ae0dcb
Merge branch 'master' into slack-v2-support
js07 Oct 19, 2025
fc32b4b
revert changes to the Slack app and components
js07 Oct 19, 2025
5dbafa7
revert formatting changes to unrelated app files
js07 Oct 19, 2025
135030d
update slack v2 component keys from slack- to slack_v2-
js07 Oct 19, 2025
cfeb6ed
add Get Current User action
js07 Oct 19, 2025
97ed7f6
revert fallback and message normalization in Find Message action
js07 Oct 19, 2025
f417859
update pnpm-lock.yaml
js07 Oct 20, 2025
68c8930
apply suggestion to improve performance of realNameLookup method
js07 Oct 20, 2025
e9699aa
fix app file imports in add-emoji-reaction.mjs and get-current-user.mjs
js07 Oct 20, 2025
8d72c9d
update components to address review comments
js07 Oct 20, 2025
ff4b476
revert change to slack update profile action
js07 Oct 20, 2025
a49bc76
set "add app to channel" default to false for send message actions
js07 Oct 21, 2025
1f27d2b
set default value for as_user prop to true in send-message-to-user-or…
js07 Oct 21, 2025
a17e69c
Merge branch 'master' into slack-v2-support
js07 Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/azure_cosmos_db/azure_cosmos_db.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/binalyze_air/binalyze_air.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/brainbase_labs/brainbase_labs.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/google_perspective/google_perspective.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/n1n/n1n.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-add-emoji-reaction",
name: "Add Emoji Reaction",
description: "Add an emoji reaction to a message. [See the documentation](https://api.slack.com/methods/reactions.add)",
version: "0.0.16",
version: "0.0.17",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "slack-approve-workflow",
name: "Approve Workflow",
description: "Suspend the workflow until approved by a Slack message. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
version: "0.0.5",
version: "0.0.6",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "slack-archive-channel",
name: "Archive Channel",
description: "Archive a channel. [See the documentation](https://api.slack.com/methods/conversations.archive)",
version: "0.0.24",
version: "0.0.25",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
26 changes: 16 additions & 10 deletions components/slack/actions/common/send-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export default {
"as_user",
],
},
addToChannel: {
propDefinition: [
slack,
"addToChannel",
],
},
post_at: {
propDefinition: [
slack,
Expand Down Expand Up @@ -181,6 +187,14 @@ export default {
},
},
async run({ $ }) {
const channelId = await this.getChannelId();

if (this.addToChannel) {
await this.slack.maybeAddAppToChannels([
channelId,
]);
}

let blocks = this.blocks;

if (!blocks) {
Expand Down Expand Up @@ -216,7 +230,7 @@ export default {

const obj = {
text: this.text,
channel: await this.getChannelId(),
channel: channelId,
attachments: this.attachments,
unfurl_links: this.unfurl_links,
unfurl_media: this.unfurl_media,
Expand All @@ -241,15 +255,7 @@ export default {
const { channel } = await this.slack.conversationsInfo({
channel: resp.channel,
});
let channelName = `#${channel?.name}`;
if (channel.is_im) {
const { profile } = await this.slack.getUserProfile({
user: channel.user,
});
channelName = `@${profile.real_name}`;
} else if (channel.is_mpim) {
channelName = `@${channel.purpose.value}`;
}
const channelName = await this.slack.getChannelDisplayName(channel);
$.export("$summary", `Successfully sent a message to ${channelName}`);
return resp;
},
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/create-channel/create-channel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-create-channel",
name: "Create a Channel",
description: "Create a new channel. [See the documentation](https://api.slack.com/methods/conversations.create)",
version: "0.0.25",
version: "0.0.26",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-create-reminder",
name: "Create Reminder",
description: "Create a reminder. [See the documentation](https://api.slack.com/methods/reminders.add)",
version: "0.0.25",
version: "0.0.26",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/delete-file/delete-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-delete-file",
name: "Delete File",
description: "Delete a file. [See the documentation](https://api.slack.com/methods/files.delete)",
version: "0.0.24",
version: "0.0.25",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/slack/actions/delete-message/delete-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-delete-message",
name: "Delete Message",
description: "Delete a message. [See the documentation](https://api.slack.com/methods/chat.delete)",
version: "0.0.24",
version: "0.1.0",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
177 changes: 151 additions & 26 deletions components/slack/actions/find-message/find-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import slack from "../../slack.app.mjs";
export default {
key: "slack-find-message",
name: "Find Message",
description: "Find a Slack message. [See the documentation](https://api.slack.com/methods/search.messages)",
version: "0.0.26",
description: "Find a Slack message. [See the documentation](https://api.slack.com/methods/assistant.search.context)",
version: "0.1.0",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand All @@ -19,18 +19,11 @@ export default {
"query",
],
},
teamId: {
propDefinition: [
slack,
"team",
],
optional: true,
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of messages to return",
default: 100,
default: 20,
optional: true,
},
sort: {
Expand All @@ -54,29 +47,161 @@ export default {
optional: true,
},
},
methods: {
normalizeAssistantMatch(match) {
if (!match || typeof match !== "object") {
return match;
}
const {
author_user_id: authorUserId,
team_id: teamId,
channel_id: channelId,
message_ts: messageTs,
content,
permalink,
is_author_bot: isAuthorBot,
message,
channel,
...rest
} = match;
const baseMessage = typeof message === "object"
? message
: {};
const channelInfo = channel && typeof channel === "object"
? {
...channel,
id: channel.id || channelId,
}
: channelId
? {
id: channelId,
}
: undefined;
const normalized = {
type: "message",
user: authorUserId,
team: teamId,
ts: messageTs,
text: content,
permalink,
channel: channelInfo,
...baseMessage,
...rest,
};
if (isAuthorBot !== undefined && normalized.is_author_bot === undefined) {
normalized.is_author_bot = isAuthorBot;
}
if (normalized.text == null) {
normalized.text = baseMessage.text || content;
}
if (normalized.ts == null) {
normalized.ts = baseMessage.ts || messageTs;
}
if (!normalized.channel && baseMessage.channel) {
normalized.channel = baseMessage.channel;
} else if (normalized.channel && baseMessage.channel && typeof baseMessage.channel === "object") {
normalized.channel = {
...normalized.channel,
...baseMessage.channel,
};
}
return normalized;
},
async searchWithAssistant(baseParams, maxResults) {
const matches = [];
let cursor;

do {
const response = await this.slack.assistantSearch({
...baseParams,
channel_types: "public_channel,private_channel",
cursor,
});
const messages = (response.results?.messages || [])
.map((item) => this.normalizeAssistantMatch(item));
matches.push(...messages);
cursor = response.response_metadata?.next_cursor;
} while (cursor && matches.length < maxResults);

return matches.slice(0, maxResults);
},
async searchWithSearchMessages(baseParams, maxResults) {
const matches = [];
let page = 1;
const count = Math.min(Math.max(maxResults, 1), 100);

while (matches.length < maxResults) {
const response = await this.slack.searchMessages({
...baseParams,
count,
page,
});
const pageMatches = response.messages?.matches || [];
matches.push(...pageMatches);

if (matches.length >= maxResults) {
break;
}

const pagination = response.messages?.pagination;
const paging = response.messages?.paging;
const hasMore = pagination
? pagination.page < pagination.page_count
: paging
? paging.page < paging.pages
: false;

if (!hasMore) {
break;
}

page += 1;
}

return matches.slice(0, maxResults);
},
shouldFallbackToSearchMessages(error) {
const errorCode = typeof error === "string"
? error
: error?.data?.error || error?.message;

if (!errorCode.includes("missing_scope")) {
return false;
}

const providedSources = [
error?.data?.provided,
error?.provided,
error?.original?.data?.provided,
].filter(Boolean);

const providedScopes = providedSources
.flatMap((value) => Array.isArray(value)
? value
: String(value).split(","))
.map((scope) => scope.trim())
.filter(Boolean);

return providedScopes.includes("search:read");
},
},
async run({ $ }) {
const matches = [];
const params = {
const maxResults = Math.max(this.maxResults ?? 20, 1);
const baseParams = {
query: this.query,
team_id: this.teamId,
sort: this.sort,
sort_dir: this.sortDirection,
page: 1,
};
let hasMore;
let matches;

do {
const { messages } = await this.slack.searchMessages(params);
matches.push(...messages.matches);
if (matches.length >= this.maxResults) {
break;
try {
matches = await this.searchWithAssistant(baseParams, maxResults);
} catch (error) {
if (this.shouldFallbackToSearchMessages(error)) {
matches = await this.searchWithSearchMessages(baseParams, maxResults);
} else {
throw error;
}
hasMore = messages.matches?.length;
params.page++;
} while (hasMore);

if (matches.length > this.maxResults) {
matches.length = this.maxResults;
}

$.export("$summary", `Found ${matches.length} matching message${matches.length === 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "slack-find-user-by-email",
name: "Find User by Email",
description: "Find a user by matching against their email. [See the documentation](https://api.slack.com/methods/users.lookupByEmail)",
version: "0.0.24",
version: "0.0.25",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Loading
Loading