@pipedream/slack 0.4.0 → 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 (48) hide show
  1. package/actions/add-star/add-star.mjs +1 -1
  2. package/actions/archive-channel/archive-channel.mjs +1 -1
  3. package/actions/common/send-message.mjs +2 -2
  4. package/actions/complete-reminder/complete-reminder.mjs +1 -1
  5. package/actions/create-channel/create-channel.mjs +1 -1
  6. package/actions/create-reminder/create-reminder.mjs +1 -1
  7. package/actions/delete-file/delete-file.mjs +1 -1
  8. package/actions/delete-message/delete-message.mjs +1 -1
  9. package/actions/delete_reminder/delete-reminder.mjs +1 -1
  10. package/actions/find-message/find-message.mjs +1 -1
  11. package/actions/find-user-by-email/find-user-by-email.mjs +1 -1
  12. package/actions/get-channel/get-channel.mjs +1 -1
  13. package/actions/get-file/get-file.mjs +1 -1
  14. package/actions/get-reminder/get-reminder.mjs +1 -1
  15. package/actions/invite-user-to-channel/invite-user-to-channel.mjs +1 -1
  16. package/actions/join-channel/join-channel.mjs +1 -1
  17. package/actions/kick-user/kick-user.mjs +1 -1
  18. package/actions/leave-channel/leave-channel.mjs +1 -1
  19. package/actions/list-channels/list-channels.mjs +1 -1
  20. package/actions/list-files/list-files.mjs +1 -1
  21. package/actions/list-members-in-channel/list-members-in-channel.mjs +1 -1
  22. package/actions/list-reminders/list-reminders.mjs +1 -1
  23. package/actions/list-replies/list-replies.mjs +1 -1
  24. package/actions/list-users/list-users.mjs +1 -1
  25. package/actions/remove-star/remove-star.mjs +1 -1
  26. package/actions/reply-to-a-message-thread/reply-to-a-message-thread.mjs +1 -1
  27. package/actions/send-block-kit-message/send-block-kit-message.mjs +1 -1
  28. package/actions/send-custom-message/send-custom-message.mjs +1 -1
  29. package/actions/send-direct-message/send-direct-message.mjs +1 -1
  30. package/actions/send-group-message/send-group-message.mjs +1 -1
  31. package/actions/send-large-message/send-large-message.mjs +91 -0
  32. package/actions/send-message-private-channel/send-message-private-channel.mjs +1 -1
  33. package/actions/send-message-public-channel/send-message-public-channel.mjs +1 -1
  34. package/actions/set-channel-topic/set-channel-topic.mjs +1 -1
  35. package/actions/set-purpose-of-channel/set-purpose-of-channel.mjs +1 -1
  36. package/actions/unarchive-channel/unarchive-channel.mjs +1 -1
  37. package/actions/update-message/update-message.mjs +1 -1
  38. package/actions/update-profile/update-profile.mjs +1 -1
  39. package/actions/upload-file/upload-file.mjs +1 -1
  40. package/package.json +1 -1
  41. package/slack.app.mjs +11 -8
  42. package/sources/common/base.mjs +14 -1
  43. package/sources/common/constants.mjs +30 -0
  44. package/sources/new-direct-message/new-direct-message.mjs +1 -1
  45. package/sources/new-mention/new-mention.mjs +4 -13
  46. package/sources/new-message-in-channels/new-message-in-channels.mjs +1 -10
  47. package/sources/new-reaction-added/new-reaction-added.mjs +7 -10
  48. package/sources/new-star-added/new-star-added.mjs +19 -3
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-add-star",
5
5
  name: "Add Star",
6
6
  description: "Add a star to an item on behalf of the authenticated user. [See docs here](https://api.slack.com/methods/stars.add)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-archive-channel",
5
5
  name: "Archive Channel",
6
6
  description: "Archive a channel. [See docs here](https://api.slack.com/methods/conversations.archive)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -61,13 +61,13 @@ export default {
61
61
  const workflowId = process.env.PIPEDREAM_WORKFLOW_ID;
62
62
  // The link is a URL without a protocol to prevent link unfurling. See
63
63
  // https://api.slack.com/reference/messaging/link-unfurling#classic_unfurl
64
- const link = `pipedream.com/@/${workflowId}?o=a&a=slack`;
64
+ const link = `https://pipedream.com/@/${workflowId}?o=a&a=slack`;
65
65
  return {
66
66
  "type": "context",
67
67
  "elements": [
68
68
  {
69
69
  "type": "mrkdwn",
70
- "text": `Sent via ${link}`,
70
+ "text": `Sent via <${link}|Pipedream>`,
71
71
  },
72
72
  ],
73
73
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-complete-reminder",
5
5
  name: "Complete Reminder",
6
6
  description: "Complete a reminder. [See docs here](https://api.slack.com/methods/reminders.complete)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-create-channel",
5
5
  name: "Create a Channel",
6
6
  description: "Create a new channel. [See docs here](https://api.slack.com/methods/conversations.create)",
7
- version: "0.0.5",
7
+ version: "0.0.6",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-create-reminder",
5
5
  name: "Create Reminder",
6
6
  description: "Create a reminder. [See docs here](https://api.slack.com/methods/reminders.add)",
7
- version: "0.0.5",
7
+ version: "0.0.6",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-delete-file",
5
5
  name: "Delete File",
6
6
  description: "Delete a file. [See docs here](https://api.slack.com/methods/files.delete)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-delete-message",
5
5
  name: "Delete Message",
6
6
  description: "Delete a message. [See docs here](https://api.slack.com/methods/chat.delete)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-delete-reminder",
5
5
  name: "Delete Reminder",
6
6
  description: "Delete a reminder. [See docs here](https://api.slack.com/methods/reminders.delete)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-find-message",
5
5
  name: "Find Message",
6
6
  description: "Find a Slack message. [See docs here](https://api.slack.com/methods/search.messages)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-find-user-by-email",
5
5
  name: "Find User by Email",
6
6
  description: "Find a user by matching against their email. [See docs here](https://api.slack.com/methods/users.lookupByEmail)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-get-channel",
5
5
  name: "Get Channel",
6
6
  description: "Return information about a workspace channel. [See docs here](https://api.slack.com/methods/conversations.info)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-get-file",
5
5
  name: "Get File",
6
6
  description: "Return information about a file. [See docs here](https://api.slack.com/methods/files.info)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-get-reminder",
5
5
  name: "Get Reminder",
6
6
  description: "Return information about a reminder. [See docs here](https://api.slack.com/methods/reminders.info)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-invite-user-to-channel",
5
5
  name: "Invite User to Channel",
6
6
  description: "Invite a user to an existing channel. [See docs here](https://api.slack.com/methods/conversations.invite)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-join-channel",
5
5
  name: "Join Channel",
6
6
  description: "Join an existing channel. [See docs here](https://api.slack.com/methods/conversations.join)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-kick-user",
5
5
  name: "Kick User",
6
6
  description: "Remove a user from a conversation. [See docs here](https://api.slack.com/methods/conversations.kick)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-leave-channel",
5
5
  name: "Leave Channel",
6
6
  description: "Leave an existing channel. [See docs here](https://api.slack.com/methods/conversations.leave)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-channels",
5
5
  name: "List Channels",
6
6
  description: "Return a list of all channels in a workspace. [See docs here](https://api.slack.com/methods/conversations.list)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-files",
5
5
  name: "List Files",
6
6
  description: "Return a list of files within a team. [See docs here](https://api.slack.com/methods/files.list)",
7
- version: "0.0.32",
7
+ version: "0.0.33",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-members-in-channel",
5
5
  name: "List Members in Channel",
6
6
  description: "Retrieve members of a channel. [See docs here](https://api.slack.com/methods/conversations.members)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-reminders",
5
5
  name: "List Reminders",
6
6
  description: "List all reminders for a given user. [See docs here](https://api.slack.com/methods/reminders.list)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-replies",
5
5
  name: "List Replies",
6
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.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-list-users",
5
5
  name: "List Users",
6
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.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-remove-star",
5
5
  name: "Remove Star",
6
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.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "slack-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.1.5",
9
+ version: "0.1.6",
10
10
  type: "action",
11
11
  props: {
12
12
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-block-kit-message",
6
6
  name: "Send Message Using Block Kit",
7
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.6",
8
+ version: "0.2.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-custom-message",
6
6
  name: "Send a Custom Message",
7
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.6",
8
+ version: "0.2.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-direct-message",
6
6
  name: "Send a Direct Message",
7
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.6",
8
+ version: "0.2.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-group-message",
6
6
  name: "Send Group Message",
7
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.6",
8
+ version: "0.2.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -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
+ };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-message-private-channel",
6
6
  name: "Send Message to a Private Channel",
7
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.7",
8
+ version: "0.2.8",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "slack-send-message-public-channel",
6
6
  name: "Send Message to a Public Channel",
7
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.6",
8
+ version: "0.2.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-set-channel-topic",
5
5
  name: "Set Channel Topic",
6
6
  description: "Set the topic on a selected channel. [See docs here](https://api.slack.com/methods/conversations.setTopic)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-set-channel-purpose",
5
5
  name: "Set Channel Purpose",
6
6
  description: "Change the purpose of a channel. [See docs here](https://api.slack.com/methods/conversations.setPurpose)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-unarchive-channel",
5
5
  name: "Unarchive Channel",
6
6
  description: "Unarchive a channel. [See docs here](https://api.slack.com/methods/conversations.unarchive)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-update-message",
5
5
  name: "Update Message",
6
6
  description: "Update a message. [See docs here](https://api.slack.com/methods/chat.update)",
7
- version: "0.1.4",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-update-profile",
5
5
  name: "Update Profile",
6
6
  description: "Update basic profile field such as name or title. [See docs here](https://api.slack.com/methods/users.profile.set)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "slack-upload-file",
5
5
  name: "Upload File",
6
6
  description: "Upload a file. [See docs here](https://api.slack.com/methods/files.upload)",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  slack,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/slack",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Pipedream Slack Components",
5
5
  "main": "slack.app.mjs",
6
6
  "keywords": [
package/slack.app.mjs CHANGED
@@ -381,30 +381,33 @@ export default {
381
381
  type: "boolean",
382
382
  label: "Ignore myself",
383
383
  description: "Ignore messages from me",
384
- default: true,
384
+ default: false,
385
385
  },
386
- word: {
386
+ keyword: {
387
387
  type: "string",
388
- label: "Word",
389
- description: "Word to monitoring",
388
+ label: "Keyword",
389
+ description: "Keyword to monitor",
390
390
  },
391
391
  isUsername: {
392
392
  type: "boolean",
393
393
  label: "Is Username",
394
- description: "Validates if the mentioned word is a username",
394
+ description: "Filters out mentions of the keyword that are not a username",
395
395
  default: false,
396
+ optional: true,
396
397
  },
397
398
  ignoreBot: {
398
399
  type: "boolean",
399
- label: "Ignore bots",
400
+ label: "Ignore Bots",
400
401
  description: "Ignore messages from bots",
401
402
  default: false,
403
+ optional: true
402
404
  },
403
405
  resolveNames: {
404
406
  type: "boolean",
405
- label: "Resolve names",
406
- description: "Resolve user and channel names (incurs extra API calls)",
407
+ label: "Resolve Names",
408
+ description: "Instead of returning `channel`, `team`, and `user` as IDs, return their human-readable names.",
407
409
  default: false,
410
+ optional: true
408
411
  },
409
412
  },
410
413
  methods: {
@@ -61,6 +61,19 @@ export default {
61
61
  }
62
62
  });
63
63
  },
64
+ async getLastMessage({
65
+ channel, event_ts,
66
+ }) {
67
+ return this.maybeCached(`lastMessage:${channel}:${event_ts}`, async () => {
68
+ const info = await this.slack.sdk().conversations.history({
69
+ channel,
70
+ latest: event_ts,
71
+ limit: 1,
72
+ inclusive: true,
73
+ });
74
+ return info;
75
+ });
76
+ },
64
77
  processEvent(event) {
65
78
  return event;
66
79
  },
@@ -76,7 +89,7 @@ export default {
76
89
 
77
90
  this.$emit(event, {
78
91
  id: event.client_msg_id || event.pipedream_msg_id,
79
- summary: this.getSummary(),
92
+ summary: this.getSummary(event),
80
93
  ts: event.event_ts || Date.now(),
81
94
  });
82
95
  }
@@ -0,0 +1,30 @@
1
+ const events = {
2
+ im: "User",
3
+ message: "Message",
4
+ file: "File",
5
+ channel: "Channel",
6
+ };
7
+
8
+ const eventsOptions = [
9
+ {
10
+ label: "User",
11
+ value: "im",
12
+ },
13
+ {
14
+ label: "Message",
15
+ value: "message",
16
+ },
17
+ {
18
+ label: "File",
19
+ value: "file",
20
+ },
21
+ {
22
+ label: "Channel",
23
+ value: "channel",
24
+ },
25
+ ];
26
+
27
+ export {
28
+ events,
29
+ eventsOptions,
30
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  ...common,
5
5
  key: "slack-new-direct-message",
6
6
  name: "New Direct Message (Instant)",
7
- version: "0.0.1",
7
+ version: "1.0.1",
8
8
  description: "Emit new event when a message was posted in a direct message channel",
9
9
  type: "source",
10
10
  dedupe: "unique",
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "slack-new-mention",
6
6
  name: "New Mention (Instant)",
7
- version: "0.0.1",
8
- description: "Emit new event when a username or specific word is mentioned in a channel",
7
+ version: "1.0.1",
8
+ description: "Emit new event when a username or specific keyword is mentioned in a channel",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -30,16 +30,10 @@ export default {
30
30
  ];
31
31
  },
32
32
  },
33
- ignoreMyself: {
33
+ keyword: {
34
34
  propDefinition: [
35
35
  common.props.slack,
36
- "ignoreMyself",
37
- ],
38
- },
39
- word: {
40
- propDefinition: [
41
- common.props.slack,
42
- "word",
36
+ "keyword",
43
37
  ],
44
38
  },
45
39
  isUsername: {
@@ -73,9 +67,6 @@ export default {
73
67
  console.log("Ignoring message with subtype.");
74
68
  return;
75
69
  }
76
- if (this.ignoreMyself && event.user == this.slack.mySlackId()) {
77
- return;
78
- }
79
70
  if ((this.ignoreBot) && (event.subtype == "bot_message" || event.bot_id)) {
80
71
  return;
81
72
  }
@@ -4,7 +4,7 @@ export default {
4
4
  ...common,
5
5
  key: "slack-new-message-in-channels",
6
6
  name: "New Message In Channels (Instant)",
7
- version: "0.0.7",
7
+ version: "1.0.1",
8
8
  description: "Emit new event when a new message is posted to one or more channels",
9
9
  type: "source",
10
10
  dedupe: "unique",
@@ -30,12 +30,6 @@ export default {
30
30
  ];
31
31
  },
32
32
  },
33
- ignoreMyself: {
34
- propDefinition: [
35
- common.props.slack,
36
- "ignoreMyself",
37
- ],
38
- },
39
33
  resolveNames: {
40
34
  propDefinition: [
41
35
  common.props.slack,
@@ -67,9 +61,6 @@ export default {
67
61
  console.log("Ignoring message with subtype.");
68
62
  return;
69
63
  }
70
- if (this.ignoreMyself && event.user == this.slack.mySlackId()) {
71
- return;
72
- }
73
64
  if ((this.ignoreBot) && (event.subtype == "bot_message" || event.bot_id)) {
74
65
  return;
75
66
  }
@@ -4,7 +4,7 @@ export default {
4
4
  ...common,
5
5
  key: "slack-new-reaction-added",
6
6
  name: "New Reaction Added (Instant)",
7
- version: "0.0.1",
7
+ version: "1.1.1",
8
8
  description: "Emit new event when a member has added an emoji reaction to an item",
9
9
  type: "source",
10
10
  dedupe: "unique",
@@ -38,12 +38,6 @@ export default {
38
38
  ];
39
39
  },
40
40
  },
41
- ignoreMyself: {
42
- propDefinition: [
43
- common.props.slack,
44
- "ignoreMyself",
45
- ],
46
- },
47
41
  ignoreBot: {
48
42
  propDefinition: [
49
43
  common.props.slack,
@@ -52,16 +46,19 @@ export default {
52
46
  },
53
47
  },
54
48
  methods: {
49
+ ...common.methods,
55
50
  getSummary() {
56
51
  return "New reaction added";
57
52
  },
58
53
  async processEvent(event) {
59
- if (this.ignoreMyself && event.user == this.slack.mySlackId()) {
60
- return;
61
- }
62
54
  if ((this.ignoreBot) && (event.subtype == "bot_message" || event.bot_id)) {
63
55
  return;
64
56
  }
57
+ event.message = await this.getLastMessage({
58
+ channel: event.item.channel,
59
+ event_ts: event.item.ts,
60
+ });
61
+
65
62
  return event;
66
63
  },
67
64
  },
@@ -1,10 +1,14 @@
1
1
  import common from "../common/base.mjs";
2
+ import {
3
+ events,
4
+ eventsOptions,
5
+ } from "../common/constants.mjs";
2
6
 
3
7
  export default {
4
8
  ...common,
5
9
  key: "slack-new-star-added",
6
10
  name: "New Star Added (Instant)",
7
- version: "0.0.1",
11
+ version: "0.0.4",
8
12
  description: "Emit new event when a star is added to an item",
9
13
  type: "source",
10
14
  dedupe: "unique",
@@ -20,11 +24,23 @@ export default {
20
24
  ];
21
25
  },
22
26
  },
27
+ eventTypes: {
28
+ type: "string[]",
29
+ label: "Event Types",
30
+ description: "The types of event to emit. If not specified, all events will be emitted.",
31
+ options: eventsOptions,
32
+ optional: true,
33
+ },
23
34
  },
24
35
  methods: {
25
36
  ...common.methods,
26
- getSummary() {
27
- return "New star added";
37
+ getSummary({ item: { type } }) {
38
+ return `New star added - ${events[type] ?? type}`;
39
+ },
40
+ async processEvent(event) {
41
+ if (this.eventTypes?.length === 0 || this.eventTypes.includes(event.item.type)) {
42
+ return event;
43
+ }
28
44
  },
29
45
  },
30
46
  };