Skip to content

Commit 28dbdb7

Browse files
authored
[FEATURE] Slack App Improvements (#15999)
* updates/improvements * pnpm-lock.yaml * update * updates * pnpm-lock.yaml
1 parent 1e4db9a commit 28dbdb7

File tree

48 files changed

+630
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+630
-185
lines changed

components/slack/actions/add-emoji-reaction/add-emoji-reaction.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-add-emoji-reaction",
55
name: "Add Emoji Reaction",
66
description: "Add an emoji reaction to a message. [See the documentation](https://api.slack.com/methods/reactions.add)",
7-
version: "0.0.14",
7+
version: "0.0.15",
88
type: "action",
99
props: {
1010
slack,
@@ -32,7 +32,7 @@ export default {
3232
},
3333
},
3434
async run({ $ }) {
35-
const response = await this.slack.sdk().reactions.add({
35+
const response = await this.slack.addReactions({
3636
channel: this.conversation,
3737
timestamp: this.timestamp,
3838
name: this.icon_emoji,

components/slack/actions/approve-workflow/approve-workflow.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "slack-approve-workflow",
66
name: "Approve Workflow",
77
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.3",
8+
version: "0.0.4",
99
type: "action",
1010
props: {
1111
slack,
@@ -44,7 +44,7 @@ export default {
4444
resume_url, cancel_url,
4545
} = $.flow.suspend();
4646

47-
const response = await this.slack.sdk().chat.postMessage({
47+
const response = await this.slack.postChatMessage({
4848
text: "Click here to approve or cancel workflow",
4949
blocks: [
5050
{

components/slack/actions/archive-channel/archive-channel.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "slack-archive-channel",
66
name: "Archive Channel",
77
description: "Archive a channel. [See the documentation](https://api.slack.com/methods/conversations.archive)",
8-
version: "0.0.22",
8+
version: "0.0.23",
99
type: "action",
1010
props: {
1111
slack,
@@ -24,7 +24,7 @@ export default {
2424
},
2525
},
2626
async run({ $ }) {
27-
const response = await this.slack.sdk().conversations.archive({
27+
const response = await this.slack.archiveConversations({
2828
channel: this.conversation,
2929
});
3030
$.export("$summary", "Successfully archived channel.");

components/slack/actions/common/send-message.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,18 @@ export default {
235235

236236
if (this.post_at) {
237237
obj.post_at = Math.floor(new Date(this.post_at).getTime() / 1000);
238-
return await this.slack.sdk().chat.scheduleMessage(obj);
238+
return await this.slack.scheduleMessage(obj);
239239
}
240-
const resp = await this.slack.sdk().chat.postMessage(obj);
240+
const resp = await this.slack.postChatMessage(obj);
241241
const { channel } = await this.slack.conversationsInfo({
242242
channel: resp.channel,
243243
});
244244
let channelName = `#${channel?.name}`;
245245
if (channel.is_im) {
246-
const usernames = await this.slack.userNames();
247-
channelName = `@${usernames[channel.user]}`;
246+
const { profile } = await this.slack.getUserProfile({
247+
user: channel.user,
248+
});
249+
channelName = `@${profile.real_name}`;
248250
} else if (channel.is_mpim) {
249251
channelName = `@${channel.purpose.value}`;
250252
}

components/slack/actions/create-channel/create-channel.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-create-channel",
55
name: "Create a Channel",
66
description: "Create a new channel. [See the documentation](https://api.slack.com/methods/conversations.create)",
7-
version: "0.0.23",
7+
version: "0.0.24",
88
type: "action",
99
props: {
1010
slack,
@@ -25,7 +25,7 @@ export default {
2525
// parse name
2626
const name = this.channelName.replace(/\s+/g, "-").toLowerCase();
2727

28-
const response = await this.slack.sdk().conversations.create({
28+
const response = await this.slack.createConversations({
2929
name,
3030
is_private: this.isPrivate,
3131
});

components/slack/actions/create-reminder/create-reminder.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-create-reminder",
55
name: "Create Reminder",
66
description: "Create a reminder. [See the documentation](https://api.slack.com/methods/reminders.add)",
7-
version: "0.0.23",
7+
version: "0.0.24",
88
type: "action",
99
props: {
1010
slack,
@@ -35,7 +35,7 @@ export default {
3535
},
3636
},
3737
async run({ $ }) {
38-
const response = await this.slack.sdk().reminders.add({
38+
const response = await this.slack.addReminders({
3939
text: this.text,
4040
team_id: this.team_id,
4141
time: this.timestamp,

components/slack/actions/delete-file/delete-file.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,28 @@ export default {
44
key: "slack-delete-file",
55
name: "Delete File",
66
description: "Delete a file. [See the documentation](https://api.slack.com/methods/files.delete)",
7-
version: "0.0.22",
7+
version: "0.0.23",
88
type: "action",
99
props: {
1010
slack,
11+
conversation: {
12+
propDefinition: [
13+
slack,
14+
"conversation",
15+
],
16+
},
1117
file: {
1218
propDefinition: [
1319
slack,
1420
"file",
21+
(c) => ({
22+
channel: c.conversation,
23+
}),
1524
],
1625
},
1726
},
1827
async run({ $ }) {
19-
const response = await this.slack.sdk().files.delete({
28+
const response = await this.slack.deleteFiles({
2029
file: this.file,
2130
});
2231
$.export("$summary", `Successfully deleted file with ID ${this.file}`);

components/slack/actions/delete-message/delete-message.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-delete-message",
55
name: "Delete Message",
66
description: "Delete a message. [See the documentation](https://api.slack.com/methods/chat.delete)",
7-
version: "0.0.22",
7+
version: "0.0.23",
88
type: "action",
99
props: {
1010
slack,
@@ -29,7 +29,7 @@ export default {
2929
},
3030
},
3131
async run({ $ }) {
32-
const response = await this.slack.sdk().chat.delete({
32+
const response = await this.slack.deleteMessage({
3333
channel: this.conversation,
3434
ts: this.timestamp,
3535
as_user: this.as_user,

components/slack/actions/find-message/find-message.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-find-message",
55
name: "Find Message",
66
description: "Find a Slack message. [See the documentation](https://api.slack.com/methods/search.messages)",
7-
version: "0.0.22",
7+
version: "0.0.23",
88
type: "action",
99
props: {
1010
slack,

components/slack/actions/find-user-by-email/find-user-by-email.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "slack-find-user-by-email",
55
name: "Find User by Email",
66
description: "Find a user by matching against their email. [See the documentation](https://api.slack.com/methods/users.lookupByEmail)",
7-
version: "0.0.22",
7+
version: "0.0.23",
88
type: "action",
99
props: {
1010
slack,
@@ -16,7 +16,7 @@ export default {
1616
},
1717
},
1818
async run({ $ }) {
19-
const response = await this.slack.sdk().users.lookupByEmail({
19+
const response = await this.slack.lookupUserByEmail({
2020
email: this.email,
2121
});
2222
if (response.ok) {

0 commit comments

Comments
 (0)