@pipedream/slack 0.3.2 → 0.4.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.
Files changed (50) hide show
  1. package/actions/add-star/add-star.mjs +43 -0
  2. package/actions/archive-channel/archive-channel.mjs +23 -0
  3. package/actions/common/send-message.mjs +170 -0
  4. package/actions/complete-reminder/complete-reminder.mjs +23 -0
  5. package/actions/create-channel/create-channel.mjs +30 -0
  6. package/actions/create-reminder/create-reminder.mjs +47 -0
  7. package/actions/delete-file/delete-file.mjs +23 -0
  8. package/actions/delete-message/delete-message.mjs +38 -0
  9. package/actions/delete_reminder/delete-reminder.mjs +23 -0
  10. package/actions/find-message/find-message.mjs +38 -0
  11. package/actions/find-user-by-email/find-user-by-email.mjs +23 -0
  12. package/actions/get-channel/get-channel.mjs +23 -0
  13. package/actions/get-file/get-file.mjs +30 -0
  14. package/actions/get-reminder/get-reminder.mjs +23 -0
  15. package/actions/invite-user-to-channel/invite-user-to-channel.mjs +31 -0
  16. package/actions/join-channel/join-channel.mjs +23 -0
  17. package/actions/kick-user/kick-user.mjs +30 -0
  18. package/actions/leave-channel/leave-channel.mjs +23 -0
  19. package/actions/list-channels/list-channels.mjs +15 -0
  20. package/actions/list-files/list-files.mjs +47 -0
  21. package/actions/list-members-in-channel/list-members-in-channel.mjs +23 -0
  22. package/actions/list-reminders/list-reminders.mjs +24 -0
  23. package/actions/list-replies/list-replies.mjs +30 -0
  24. package/actions/list-users/list-users.mjs +22 -0
  25. package/actions/remove-star/remove-star.mjs +40 -0
  26. package/actions/reply-to-a-message-thread/reply-to-a-message-thread.mjs +41 -0
  27. package/actions/send-block-kit-message/send-block-kit-message.mjs +33 -0
  28. package/actions/send-custom-message/send-custom-message.mjs +79 -0
  29. package/actions/send-direct-message/send-direct-message.mjs +52 -0
  30. package/actions/send-group-message/send-group-message.mjs +52 -0
  31. package/actions/send-large-message/send-large-message.mjs +91 -0
  32. package/actions/send-message-private-channel/send-message-private-channel.mjs +52 -0
  33. package/actions/send-message-public-channel/send-message-public-channel.mjs +52 -0
  34. package/actions/set-channel-topic/set-channel-topic.mjs +30 -0
  35. package/actions/set-purpose-of-channel/set-purpose-of-channel.mjs +30 -0
  36. package/actions/unarchive-channel/unarchive-channel.mjs +23 -0
  37. package/actions/update-message/update-message.mjs +52 -0
  38. package/actions/update-profile/update-profile.mjs +30 -0
  39. package/actions/upload-file/upload-file.mjs +38 -0
  40. package/package.json +19 -16
  41. package/slack.app.mjs +544 -0
  42. package/sources/common/base.mjs +97 -0
  43. package/sources/common/constants.mjs +30 -0
  44. package/sources/new-direct-message/new-direct-message.mjs +51 -0
  45. package/sources/new-mention/new-mention.mjs +95 -0
  46. package/sources/new-message-in-channels/new-message-in-channels.mjs +84 -0
  47. package/sources/new-reaction-added/new-reaction-added.mjs +65 -0
  48. package/sources/new-star-added/new-star-added.mjs +46 -0
  49. package/slack.app.js +0 -48
  50. package/sources/new-message-in-channels/new-message-in-channels.js +0 -151
@@ -0,0 +1,47 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-list-files",
5
+ name: "List Files",
6
+ description: "Return a list of files within a team. [See docs here](https://api.slack.com/methods/files.list)",
7
+ version: "0.0.33",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ conversation: {
12
+ propDefinition: [
13
+ slack,
14
+ "conversation",
15
+ ],
16
+ },
17
+ count: {
18
+ propDefinition: [
19
+ slack,
20
+ "count",
21
+ ],
22
+ optional: true,
23
+ },
24
+ team_id: {
25
+ propDefinition: [
26
+ slack,
27
+ "team",
28
+ ],
29
+ optional: true,
30
+ },
31
+ user: {
32
+ propDefinition: [
33
+ slack,
34
+ "user",
35
+ ],
36
+ optional: true,
37
+ },
38
+ },
39
+ async run() {
40
+ return await this.slack.sdk().files.list({
41
+ channel: this.conversation,
42
+ count: this.count,
43
+ user: this.user,
44
+ team_id: this.team_id,
45
+ });
46
+ },
47
+ };
@@ -0,0 +1,23 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-list-members-in-channel",
5
+ name: "List Members in Channel",
6
+ description: "Retrieve members of a channel. [See docs here](https://api.slack.com/methods/conversations.members)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ conversation: {
12
+ propDefinition: [
13
+ slack,
14
+ "conversation",
15
+ ],
16
+ },
17
+ },
18
+ async run() {
19
+ return await this.slack.sdk().conversations.members({
20
+ channel: this.conversation,
21
+ });
22
+ },
23
+ };
@@ -0,0 +1,24 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-list-reminders",
5
+ name: "List Reminders",
6
+ description: "List all reminders for a given user. [See docs here](https://api.slack.com/methods/reminders.list)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ team_id: {
12
+ propDefinition: [
13
+ slack,
14
+ "team",
15
+ ],
16
+ optional: true,
17
+ },
18
+ },
19
+ async run() {
20
+ return await this.slack.sdk().reminders.list({
21
+ team_id: this.team_id,
22
+ });
23
+ },
24
+ };
@@ -0,0 +1,30 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-list-replies",
5
+ name: "List Replies",
6
+ description: "Retrieve a thread of messages posted to a conversation. [See docs here](https://api.slack.com/methods/conversations.replies)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ conversation: {
12
+ propDefinition: [
13
+ slack,
14
+ "conversation",
15
+ ],
16
+ },
17
+ timestamp: {
18
+ propDefinition: [
19
+ slack,
20
+ "timestamp",
21
+ ],
22
+ },
23
+ },
24
+ async run() {
25
+ return await this.slack.sdk().conversations.replies({
26
+ channel: this.conversation,
27
+ ts: this.timestamp,
28
+ });
29
+ },
30
+ };
@@ -0,0 +1,22 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-list-users",
5
+ name: "List Users",
6
+ description: "Return a list of all users in a workspace. [See docs here](https://api.slack.com/methods/users.list)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ team_id: {
12
+ propDefinition: [
13
+ slack,
14
+ "team",
15
+ ],
16
+ optional: true,
17
+ },
18
+ },
19
+ async run() {
20
+ return await this.slack.sdk().users.list();
21
+ },
22
+ };
@@ -0,0 +1,40 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-remove-star",
5
+ name: "Remove Star",
6
+ description: "Remove a star from an item on behalf of the authenticated user. [See docs here](https://api.slack.com/methods/stars.remove)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ conversation: {
12
+ propDefinition: [
13
+ slack,
14
+ "conversation",
15
+ ],
16
+ optional: true,
17
+ },
18
+ timestamp: {
19
+ propDefinition: [
20
+ slack,
21
+ "timestamp",
22
+ ],
23
+ optional: true,
24
+ },
25
+ file: {
26
+ propDefinition: [
27
+ slack,
28
+ "file",
29
+ ],
30
+ optional: true,
31
+ },
32
+ },
33
+ async run() {
34
+ return await this.slack.sdk().stars.remove({
35
+ channel: this.conversation,
36
+ timestamp: this.timestamp,
37
+ file: this.file,
38
+ });
39
+ },
40
+ };
@@ -0,0 +1,41 @@
1
+ import slack from "../../slack.app.mjs";
2
+ import common from "../common/send-message.mjs";
3
+
4
+ export default {
5
+ ...common,
6
+ key: "slack-reply-to-a-message",
7
+ name: "Reply to a Message Thread",
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.1.6",
10
+ type: "action",
11
+ props: {
12
+ ...common.props,
13
+ thread_ts: {
14
+ propDefinition: [
15
+ slack,
16
+ "thread_ts",
17
+ ],
18
+ optional: false,
19
+ },
20
+ conversation: {
21
+ propDefinition: [
22
+ slack,
23
+ "conversation",
24
+ ],
25
+ optional: false,
26
+ },
27
+ text: {
28
+ propDefinition: [
29
+ slack,
30
+ "text",
31
+ ],
32
+ optional: false,
33
+ },
34
+ mrkdwn: {
35
+ propDefinition: [
36
+ slack,
37
+ "mrkdwn",
38
+ ],
39
+ },
40
+ },
41
+ };
@@ -0,0 +1,33 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-block-kit-message",
6
+ name: "Send Message Using Block Kit",
7
+ description: "Send a message using Slack's Block Kit UI framework 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.2.7",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "conversation",
16
+ ],
17
+ optional: false,
18
+ },
19
+ blocks: {
20
+ propDefinition: [
21
+ common.props.slack,
22
+ "blocks",
23
+ ],
24
+ optional: false,
25
+ },
26
+ text: {
27
+ propDefinition: [
28
+ common.props.slack,
29
+ "notificationText",
30
+ ],
31
+ },
32
+ },
33
+ };
@@ -0,0 +1,79 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-custom-message",
6
+ name: "Send a Custom Message",
7
+ description: "Customize advanced setttings 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",
8
+ version: "0.2.7",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "conversation",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ attachments: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "attachments",
34
+ ],
35
+ },
36
+ unfurl_links: {
37
+ propDefinition: [
38
+ common.props.slack,
39
+ "unfurl_links",
40
+ ],
41
+ },
42
+ unfurl_media: {
43
+ propDefinition: [
44
+ common.props.slack,
45
+ "unfurl_media",
46
+ ],
47
+ },
48
+ parse: {
49
+ propDefinition: [
50
+ common.props.slack,
51
+ "parse",
52
+ ],
53
+ },
54
+ blocks: {
55
+ propDefinition: [
56
+ common.props.slack,
57
+ "blocks",
58
+ ],
59
+ },
60
+ link_names: {
61
+ propDefinition: [
62
+ common.props.slack,
63
+ "link_names",
64
+ ],
65
+ },
66
+ reply_broadcast: {
67
+ propDefinition: [
68
+ common.props.slack,
69
+ "reply_broadcast",
70
+ ],
71
+ },
72
+ thread_ts: {
73
+ propDefinition: [
74
+ common.props.slack,
75
+ "thread_ts",
76
+ ],
77
+ },
78
+ },
79
+ };
@@ -0,0 +1,52 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-direct-message",
6
+ name: "Send a Direct Message",
7
+ description: "Send a direct message to a single user. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
8
+ version: "0.2.7",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "user",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ username: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "username",
34
+ ],
35
+ description: "Optionally customize your bot's username (default is `Pipedream`).",
36
+ },
37
+ icon_emoji: {
38
+ propDefinition: [
39
+ common.props.slack,
40
+ "icon_emoji",
41
+ ],
42
+ description: "Optionally use an emoji as the bot icon for this message (e.g., `:fire:`). This value overrides `icon_url` if both are provided.",
43
+ },
44
+ icon_url: {
45
+ propDefinition: [
46
+ common.props.slack,
47
+ "icon_url",
48
+ ],
49
+ description: "Optionally provide an image URL to use as the bot icon for this message.",
50
+ },
51
+ },
52
+ };
@@ -0,0 +1,52 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-group-message",
6
+ name: "Send Group Message",
7
+ description: "Send a direct message to a group of users. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
8
+ version: "0.2.7",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "group",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ username: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "username",
34
+ ],
35
+ description: "Optionally customize your bot's username (default is `Pipedream`).",
36
+ },
37
+ icon_emoji: {
38
+ propDefinition: [
39
+ common.props.slack,
40
+ "icon_emoji",
41
+ ],
42
+ description: "Optionally use an emoji as the bot icon for this message (e.g., `:fire:`). This value overrides `icon_url` if both are provided.",
43
+ },
44
+ icon_url: {
45
+ propDefinition: [
46
+ common.props.slack,
47
+ "icon_url",
48
+ ],
49
+ description: "Optionally provide an image URL to use as the bot icon for this message.",
50
+ },
51
+ },
52
+ };
@@ -0,0 +1,91 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-large-message",
6
+ name: "Send a Large Message (3000+ characters)",
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.0.3",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "conversation",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ username: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "username",
34
+ ],
35
+ description: "Optionally customize your bot's username (default is `Pipedream`).",
36
+ },
37
+ icon_emoji: {
38
+ propDefinition: [
39
+ common.props.slack,
40
+ "icon_emoji",
41
+ ],
42
+ description: "Optionally use an emoji as the bot icon for this message (e.g., `:fire:`). This value overrides `icon_url` if both are provided.",
43
+ },
44
+ icon_url: {
45
+ propDefinition: [
46
+ common.props.slack,
47
+ "icon_url",
48
+ ],
49
+ description: "Optionally provide an image URL to use as the bot icon for this message.",
50
+ },
51
+ },
52
+ async run() {
53
+ if (this.include_sent_via_pipedream_flag) {
54
+ const sentViaPipedreamText = this._makeSentViaPipedreamBlock();
55
+ this.text += `\n\n\n${sentViaPipedreamText.elements[0].text}`;
56
+ }
57
+
58
+ let metadataEventPayload;
59
+
60
+ if (this.metadata_event_type) {
61
+ try {
62
+ metadataEventPayload = JSON.parse(this.metadata_event_payload);
63
+ } catch (error) {
64
+ throw new Error(`Invalid JSON in metadata_event_payload: ${error.message}`);
65
+ }
66
+
67
+ this.metadata = {
68
+ event_type: this.metadata_event_type,
69
+ event_payload: metadataEventPayload,
70
+ };
71
+ }
72
+
73
+ const obj = {
74
+ text: this.text,
75
+ channel: this.conversation,
76
+ as_user: this.as_user,
77
+ username: this.username,
78
+ icon_emoji: this.icon_emoji,
79
+ icon_url: this.icon_url,
80
+ mrkdwn: this.mrkdwn,
81
+ metadata: this.metadata || null,
82
+ };
83
+
84
+ if (this.post_at) {
85
+ obj.post_at = this.post_at;
86
+ return this.slack.sdk().chat.scheduleMessage(obj);
87
+ }
88
+
89
+ return this.slack.sdk().chat.postMessage(obj);
90
+ },
91
+ };
@@ -0,0 +1,52 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-message-private-channel",
6
+ name: "Send Message to a Private Channel",
7
+ description: "Send a message to a private channel and customize the name and avatar of the bot that posts the message. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
8
+ version: "0.2.8",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "privateChannel",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ username: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "username",
34
+ ],
35
+ description: "Optionally customize your bot's username (default is `Pipedream`).",
36
+ },
37
+ icon_emoji: {
38
+ propDefinition: [
39
+ common.props.slack,
40
+ "icon_emoji",
41
+ ],
42
+ description: "Optionally use an emoji as the bot icon for this message (e.g., `:fire:`). This value overrides `icon_url` if both are provided.",
43
+ },
44
+ icon_url: {
45
+ propDefinition: [
46
+ common.props.slack,
47
+ "icon_url",
48
+ ],
49
+ description: "Optionally provide an image URL to use as the bot icon for this message.",
50
+ },
51
+ },
52
+ };
@@ -0,0 +1,52 @@
1
+ import common from "../common/send-message.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "slack-send-message-public-channel",
6
+ name: "Send Message to a Public Channel",
7
+ description: "Send a message to a public channel and customize the name and avatar of the bot that posts the message. See [postMessage](https://api.slack.com/methods/chat.postMessage) or [scheduleMessage](https://api.slack.com/methods/chat.scheduleMessage) docs here",
8
+ version: "0.2.7",
9
+ type: "action",
10
+ props: {
11
+ ...common.props,
12
+ conversation: {
13
+ propDefinition: [
14
+ common.props.slack,
15
+ "publicChannel",
16
+ ],
17
+ },
18
+ text: {
19
+ propDefinition: [
20
+ common.props.slack,
21
+ "text",
22
+ ],
23
+ },
24
+ mrkdwn: {
25
+ propDefinition: [
26
+ common.props.slack,
27
+ "mrkdwn",
28
+ ],
29
+ },
30
+ username: {
31
+ propDefinition: [
32
+ common.props.slack,
33
+ "username",
34
+ ],
35
+ description: "Optionally customize your bot's username (default is `Pipedream`).",
36
+ },
37
+ icon_emoji: {
38
+ propDefinition: [
39
+ common.props.slack,
40
+ "icon_emoji",
41
+ ],
42
+ description: "Optionally use an emoji as the bot icon for this message (e.g., `:fire:`). This value overrides `icon_url` if both are provided.",
43
+ },
44
+ icon_url: {
45
+ propDefinition: [
46
+ common.props.slack,
47
+ "icon_url",
48
+ ],
49
+ description: "Optionally provide an image URL to use as the bot icon for this message.",
50
+ },
51
+ },
52
+ };
@@ -0,0 +1,30 @@
1
+ import slack from "../../slack.app.mjs";
2
+
3
+ export default {
4
+ key: "slack-set-channel-topic",
5
+ name: "Set Channel Topic",
6
+ description: "Set the topic on a selected channel. [See docs here](https://api.slack.com/methods/conversations.setTopic)",
7
+ version: "0.0.5",
8
+ type: "action",
9
+ props: {
10
+ slack,
11
+ conversation: {
12
+ propDefinition: [
13
+ slack,
14
+ "conversation",
15
+ ],
16
+ },
17
+ topic: {
18
+ propDefinition: [
19
+ slack,
20
+ "topic",
21
+ ],
22
+ },
23
+ },
24
+ async run() {
25
+ return await this.slack.sdk().conversations.setTopic({
26
+ channel: this.conversation,
27
+ topic: this.topic,
28
+ });
29
+ },
30
+ };