@activepieces/piece-slack 0.8.1 → 0.8.3
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/package.json +4 -4
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/lib/common/utils.d.ts +7 -0
- package/src/lib/common/utils.js +29 -0
- package/src/lib/common/utils.js.map +1 -1
- package/src/lib/triggers/new-command-in-direct-message.d.ts +17 -0
- package/src/lib/triggers/new-command-in-direct-message.js +74 -0
- package/src/lib/triggers/new-command-in-direct-message.js.map +1 -0
- package/src/lib/triggers/new-command.js +7 -113
- package/src/lib/triggers/new-command.js.map +1 -1
- package/src/lib/triggers/new-direct-message.js +1 -34
- package/src/lib/triggers/new-direct-message.js.map +1 -1
- package/src/lib/triggers/new-mention-in-direct-message.d.ts +14 -0
- package/src/lib/triggers/new-mention-in-direct-message.js +63 -0
- package/src/lib/triggers/new-mention-in-direct-message.js.map +1 -0
- package/src/lib/triggers/new-mention.js +9 -62
- package/src/lib/triggers/new-mention.js.map +1 -1
- package/src/lib/triggers/new-message-in-channel.js +5 -55
- package/src/lib/triggers/new-message-in-channel.js.map +1 -1
- package/src/lib/triggers/new-message.js +5 -60
- package/src/lib/triggers/new-message.js.map +1 -1
- package/src/lib/triggers/new-reaction-added.js +1 -55
- package/src/lib/triggers/new-reaction-added.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-slack",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@anthropic-ai/sdk": "0.33.1",
|
|
6
6
|
"@sinclair/typebox": "0.34.11",
|
|
7
|
-
"@slack/web-api": "7.0
|
|
8
|
-
"axios": "1.8.
|
|
7
|
+
"@slack/web-api": "7.9.0",
|
|
8
|
+
"axios": "1.8.3",
|
|
9
9
|
"axios-retry": "4.4.1",
|
|
10
10
|
"deepmerge-ts": "7.1.0",
|
|
11
11
|
"mime-types": "2.1.35",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"zod": "3.23.8",
|
|
18
18
|
"@activepieces/pieces-common": "0.4.3",
|
|
19
19
|
"@activepieces/pieces-framework": "0.7.46",
|
|
20
|
-
"@activepieces/shared": "0.10.
|
|
20
|
+
"@activepieces/shared": "0.10.164",
|
|
21
21
|
"tslib": "1.14.1"
|
|
22
22
|
},
|
|
23
23
|
"overrides": {
|
package/src/index.js
CHANGED
|
@@ -32,6 +32,8 @@ const new_message_1 = require("./lib/triggers/new-message");
|
|
|
32
32
|
const new_message_in_channel_1 = require("./lib/triggers/new-message-in-channel");
|
|
33
33
|
const new_direct_message_1 = require("./lib/triggers/new-direct-message");
|
|
34
34
|
const retrieve_thread_messages_1 = require("./lib/actions/retrieve-thread-messages");
|
|
35
|
+
const new_mention_in_direct_message_1 = require("./lib/triggers/new-mention-in-direct-message");
|
|
36
|
+
const new_command_in_direct_message_1 = require("./lib/triggers/new-command-in-direct-message");
|
|
35
37
|
exports.slackAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
36
38
|
description: '',
|
|
37
39
|
authUrl: 'https://slack.com/oauth/v2/authorize?user_scope=search:read,users.profile:write,reactions:read,im:history',
|
|
@@ -159,8 +161,10 @@ exports.slack = (0, pieces_framework_1.createPiece)({
|
|
|
159
161
|
new_message_in_channel_1.newMessageInChannelTrigger,
|
|
160
162
|
new_direct_message_1.newDirectMessageTrigger,
|
|
161
163
|
new_mention_1.newMention,
|
|
164
|
+
new_mention_in_direct_message_1.newMentionInDirectMessageTrigger,
|
|
162
165
|
new_reaction_added_1.newReactionAdded,
|
|
163
166
|
new_channel_1.channelCreated, new_command_1.newCommand,
|
|
167
|
+
new_command_in_direct_message_1.newCommandInDirectMessageTrigger
|
|
164
168
|
],
|
|
165
169
|
});
|
|
166
170
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/slack/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAKwC;AACxC,iDAAqD;AACrD,sEAAiC;AACjC,+FAA+F;AAC/F,iFAAkF;AAClF,mGAAmG;AACnG,qFAA0F;AAC1F,yFAAwF;AACxF,2EAA2E;AAC3E,0EAAqE;AACrE,2DAAuD;AACvD,mEAA+D;AAC/D,iEAA6D;AAC7D,yEAAyE;AACzE,iEAAmE;AACnE,iEAAmE;AACnE,4DAA4D;AAC5D,mFAAkF;AAClF,2EAAsE;AACtE,2EAA2E;AAC3E,mEAAoE;AACpE,4DAAwD;AACxD,qFAA+E;AAC/E,4DAAwD;AACxD,qDAAuD;AACvD,4DAA+D;AAC/D,kFAAmF;AACnF,0EAA4E;AAC5E,qFAAgF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/slack/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAKwC;AACxC,iDAAqD;AACrD,sEAAiC;AACjC,+FAA+F;AAC/F,iFAAkF;AAClF,mGAAmG;AACnG,qFAA0F;AAC1F,yFAAwF;AACxF,2EAA2E;AAC3E,0EAAqE;AACrE,2DAAuD;AACvD,mEAA+D;AAC/D,iEAA6D;AAC7D,yEAAyE;AACzE,iEAAmE;AACnE,iEAAmE;AACnE,4DAA4D;AAC5D,mFAAkF;AAClF,2EAAsE;AACtE,2EAA2E;AAC3E,mEAAoE;AACpE,4DAAwD;AACxD,qFAA+E;AAC/E,4DAAwD;AACxD,qDAAuD;AACvD,4DAA+D;AAC/D,kFAAmF;AACnF,0EAA4E;AAC5E,qFAAgF;AAChF,gGAAgG;AAChG,gGAAgG;AAEnF,QAAA,SAAS,GAAG,4BAAS,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,EAAE;IACf,OAAO,EACN,2GAA2G;IAC5G,QAAQ,EAAE,uCAAu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AC,QAAQ,CAAC;oBAC/B,WAAW,EAAE,gBAAgB;oBAC7B,WAAW,EAAE,qCAAqC;oBAClD,QAAQ,EAAE,IAAI;oBACd,YAAY,EAAE,KAAK;iBACnB,CAAC;aACF;SACD,CAAC;KACF;IACD,QAAQ,EAAE;QACT,+BAAiB;QACjB,mDAA0B;QAC1B,4CAAuB;QACvB,wBAAU;QACV,gEAAgC;QAChC,qCAAgB;QAChB,4BAAc,EAAE,wBAAU;QAC1B,gEAAgC;KAEhC;CACD,CAAC,CAAC"}
|
|
@@ -12,4 +12,11 @@ type SlackSendMessageParams = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function processMessageTimestamp(input: string): string | undefined;
|
|
14
14
|
export declare function getFirstFiveOrAll(array: unknown[]): unknown[];
|
|
15
|
+
/**
|
|
16
|
+
* Parse a message text to extract command and arguments
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseCommand(text: string, botUserId: string, validCommands: string[]): {
|
|
19
|
+
command: string;
|
|
20
|
+
args: string[];
|
|
21
|
+
} | null;
|
|
15
22
|
export {};
|
package/src/lib/common/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.slackSendMessage = void 0;
|
|
4
4
|
exports.processMessageTimestamp = processMessageTimestamp;
|
|
5
5
|
exports.getFirstFiveOrAll = getFirstFiveOrAll;
|
|
6
|
+
exports.parseCommand = parseCommand;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const web_api_1 = require("@slack/web-api");
|
|
8
9
|
const slackSendMessage = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ text, conversationId, username, profilePicture, blocks, threadTs, token, file, }) {
|
|
@@ -57,4 +58,32 @@ function getFirstFiveOrAll(array) {
|
|
|
57
58
|
return array.slice(0, 5);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse a message text to extract command and arguments
|
|
63
|
+
*/
|
|
64
|
+
function parseCommand(text, botUserId, validCommands) {
|
|
65
|
+
if (!botUserId) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
// Check if the message mentions the bot
|
|
69
|
+
const mentionRegex = new RegExp(`<@${botUserId}>\\s+(.+)`, 's');
|
|
70
|
+
const mentionMatch = text.match(mentionRegex);
|
|
71
|
+
if (!mentionMatch) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
// Extract the text after the mention
|
|
75
|
+
const commandText = mentionMatch[1].trim();
|
|
76
|
+
// Split into command and arguments (first word is command, rest are args)
|
|
77
|
+
const parts = commandText.split(/\s+/);
|
|
78
|
+
const command = parts[0].toLowerCase();
|
|
79
|
+
const args = parts.slice(1);
|
|
80
|
+
// Check if it's a valid command
|
|
81
|
+
if (!validCommands.includes(command)) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
command,
|
|
86
|
+
args,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
60
89
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/common/utils.ts"],"names":[],"mappings":";;;AAkDA,0DAkBC;AAED,8CAMC;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/common/utils.ts"],"names":[],"mappings":";;;AAkDA,0DAkBC;AAED,8CAMC;AAKD,oCAkCC;;AAlHD,4CAAkD;AAE3C,MAAM,gBAAgB,GAAG,KASL,EAAE,oDATU,EACrC,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,MAAM,EACN,QAAQ,EACR,KAAK,EACL,IAAI,GACmB;IACvB,MAAM,MAAM,GAAG,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;IAEpC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,MAAM,MAAM,CAAC,KAAK,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CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED;;EAEE;AACF,SAAgB,YAAY,CAC3B,IAAY,EACZ,SAAiB,EACjB,aAAuB;IAEvB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wCAAwC;IACxC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,SAAS,WAAW,EAAE,GAAG,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qCAAqC;IACrC,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAE3C,0EAA0E;IAC1E,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5B,gCAAgC;IAChC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI;KACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newCommandInDirectMessageTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
3
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
commands: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
5
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
6
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
7
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
8
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
9
|
+
commands: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
10
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
11
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
12
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
13
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
14
|
+
commands: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
15
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
16
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newCommandInDirectMessageTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const props_1 = require("../common/props");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
const utils_1 = require("../common/utils");
|
|
9
|
+
exports.newCommandInDirectMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
10
|
+
auth: __1.slackAuth,
|
|
11
|
+
name: 'new-command-in-direct-message',
|
|
12
|
+
displayName: 'New Command in Direct Message',
|
|
13
|
+
description: 'Triggers when a specific command is sent to the bot (e.g., @bot command arg1 arg2) via Direct Message.',
|
|
14
|
+
props: {
|
|
15
|
+
user: props_1.userId,
|
|
16
|
+
commands: pieces_framework_1.Property.Array({
|
|
17
|
+
displayName: 'Commands',
|
|
18
|
+
description: 'List of valid commands that the bot should respond to (e.g., help, ocr, remind)',
|
|
19
|
+
required: true,
|
|
20
|
+
defaultValue: ['help'],
|
|
21
|
+
}),
|
|
22
|
+
ignoreBots: pieces_framework_1.Property.Checkbox({
|
|
23
|
+
displayName: 'Ignore Bot Messages ?',
|
|
24
|
+
required: true,
|
|
25
|
+
defaultValue: true,
|
|
26
|
+
}),
|
|
27
|
+
ignoreSelfMessages: pieces_framework_1.Property.Checkbox({
|
|
28
|
+
displayName: 'Ignore Message from Yourself ?',
|
|
29
|
+
required: true,
|
|
30
|
+
defaultValue: false,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
34
|
+
sampleData: undefined,
|
|
35
|
+
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
var _a;
|
|
37
|
+
// Older OAuth2 has team_id, newer has team.id
|
|
38
|
+
const teamId = (_a = context.auth.data['team_id']) !== null && _a !== void 0 ? _a : context.auth.data['team']['id'];
|
|
39
|
+
context.app.createListeners({
|
|
40
|
+
events: ['message'],
|
|
41
|
+
identifierValue: teamId,
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
// Ignored
|
|
46
|
+
}),
|
|
47
|
+
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const payloadBody = context.payload.body;
|
|
50
|
+
const commands = (_a = context.propsValue.commands) !== null && _a !== void 0 ? _a : [];
|
|
51
|
+
const user = context.propsValue.user;
|
|
52
|
+
const authUserId = (_b = context.auth.data['authed_user']) === null || _b === void 0 ? void 0 : _b.id;
|
|
53
|
+
if (payloadBody.event.channel_type !== 'im') {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
// Check for bot messages if configured to ignore them
|
|
57
|
+
if ((context.propsValue.ignoreBots && payloadBody.event.bot_id) ||
|
|
58
|
+
(context.propsValue.ignoreSelfMessages && payloadBody.event.user === authUserId)) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
// Check for mention and parse command
|
|
62
|
+
if (user && payloadBody.event.text) {
|
|
63
|
+
const parsedCommand = (0, utils_1.parseCommand)(payloadBody.event.text, user, commands);
|
|
64
|
+
if (parsedCommand && commands.includes(parsedCommand.command)) {
|
|
65
|
+
// Return event with parsed command
|
|
66
|
+
return [
|
|
67
|
+
Object.assign(Object.assign({}, payloadBody.event), { parsed_command: parsedCommand }),
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return [];
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=new-command-in-direct-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-command-in-direct-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-command-in-direct-message.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,2CAAyC;AACzC,8BAAmC;AACnC,2CAA+C;AAElC,QAAA,gCAAgC,GAAG,IAAA,gCAAa,EAAC;IAC5D,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EACT,wGAAwG;IAC1G,KAAK,EAAE;QACL,IAAI,EAAE,cAAM;QACZ,QAAQ,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACvB,WAAW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W,CAAC,KAAK,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YAC1C,OAAO,EAAE,CAAC;QACd,CAAC;QAED,sDAAsD;QACxD,IACC,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;YAC3D,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,EAC/E,CAAC;YACF,OAAO,EAAE,CAAC;QACX,CAAC;QAEC,sCAAsC;QACtC,IAAI,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,aAAa,GAAG,IAAA,oBAAY,EAChC,WAAW,CAAC,KAAK,CAAC,IAAI,EACtB,IAAI,EACJ,QAAQ,CACT,CAAC;YAEF,IAAI,aAAa,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9D,mCAAmC;gBACnC,OAAO;oDAEA,WAAW,CAAC,KAAK,KACpB,cAAc,EAAE,aAAa;iBAEhC,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -5,49 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const props_1 = require("../common/props");
|
|
7
7
|
const __1 = require("../../");
|
|
8
|
-
const web_api_1 = require("@slack/web-api");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
8
|
const utils_1 = require("../common/utils");
|
|
11
|
-
const sampleData = {
|
|
12
|
-
client_msg_id: '2767cf34-0651-44e0-b9c8-1b167ce9b7a9',
|
|
13
|
-
type: 'message',
|
|
14
|
-
text: '<@U07BN652T52> help argument1 argument2',
|
|
15
|
-
user: 'U037UG6FKPU',
|
|
16
|
-
ts: '1678231735.586539',
|
|
17
|
-
blocks: [
|
|
18
|
-
{
|
|
19
|
-
type: 'rich_text',
|
|
20
|
-
block_id: 'jCFSh',
|
|
21
|
-
elements: [
|
|
22
|
-
{
|
|
23
|
-
type: 'rich_text_section',
|
|
24
|
-
elements: [
|
|
25
|
-
{
|
|
26
|
-
type: 'user',
|
|
27
|
-
user_id: 'U07BN652T52',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'text',
|
|
31
|
-
text: ' help argument1 argument2',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
team: 'T037MS4FGDC',
|
|
39
|
-
channel: 'C037RTX2ZDM',
|
|
40
|
-
event_ts: '1678231735.586539',
|
|
41
|
-
channel_type: 'channel',
|
|
42
|
-
parsed_command: {
|
|
43
|
-
command: 'help',
|
|
44
|
-
args: ['argument1', 'argument2'],
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
9
|
exports.newCommand = (0, pieces_framework_1.createTrigger)({
|
|
48
10
|
auth: __1.slackAuth,
|
|
49
11
|
name: 'new_command',
|
|
50
|
-
displayName: 'New Command',
|
|
12
|
+
displayName: 'New Command in Channel',
|
|
51
13
|
description: 'Triggers when a specific command is sent to the bot (e.g., @bot command arg1 arg2)',
|
|
52
14
|
props: {
|
|
53
15
|
info: props_1.multiSelectChannelInfo,
|
|
@@ -90,7 +52,7 @@ exports.newCommand = (0, pieces_framework_1.createTrigger)({
|
|
|
90
52
|
}),
|
|
91
53
|
},
|
|
92
54
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
93
|
-
sampleData:
|
|
55
|
+
sampleData: undefined,
|
|
94
56
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
95
57
|
var _a;
|
|
96
58
|
// Older OAuth2 has team_id, newer has team.id
|
|
@@ -103,56 +65,16 @@ exports.newCommand = (0, pieces_framework_1.createTrigger)({
|
|
|
103
65
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
104
66
|
// Ignored
|
|
105
67
|
}),
|
|
106
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
-
const channels = context.propsValue.channels;
|
|
108
|
-
const commands = context.propsValue.commands;
|
|
109
|
-
const user = context.propsValue.user;
|
|
110
|
-
if (!channels || (Array.isArray(channels) && channels.length === 0)) {
|
|
111
|
-
return [
|
|
112
|
-
Object.assign(Object.assign({}, sampleData), { parsed_command: {
|
|
113
|
-
command: commands.length > 0 ? commands[0] : 'help',
|
|
114
|
-
args: ['argument1', 'argument2'],
|
|
115
|
-
} }),
|
|
116
|
-
];
|
|
117
|
-
}
|
|
118
|
-
const client = new web_api_1.WebClient(context.auth.access_token);
|
|
119
|
-
const response = yield client.conversations.history({
|
|
120
|
-
channel: channels[0],
|
|
121
|
-
limit: 100,
|
|
122
|
-
});
|
|
123
|
-
if (!response.messages) {
|
|
124
|
-
return [];
|
|
125
|
-
}
|
|
126
|
-
// Filter and process messages with bot mention + command
|
|
127
|
-
const processedMessages = response.messages
|
|
128
|
-
.filter((message) => !(0, shared_1.isNil)(message.ts))
|
|
129
|
-
.filter((message) => {
|
|
130
|
-
// Ignore bot messages if configured to do so
|
|
131
|
-
if (context.propsValue.ignoreBots && message.bot_id) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
// Look for mentions of the bot user
|
|
135
|
-
return message.text && message.text.includes(`<@${user}>`);
|
|
136
|
-
})
|
|
137
|
-
.map((message) => {
|
|
138
|
-
// Parse the command
|
|
139
|
-
const parsedCommand = parseCommand(message.text || '', user, commands);
|
|
140
|
-
// Only include messages with valid commands
|
|
141
|
-
if (parsedCommand && commands.includes(parsedCommand.command)) {
|
|
142
|
-
return Object.assign(Object.assign({}, message), { channel: channels[0], event_ts: '1678231735.586539', channel_type: 'channel', parsed_command: parsedCommand });
|
|
143
|
-
}
|
|
144
|
-
return null;
|
|
145
|
-
})
|
|
146
|
-
.filter((message) => message !== null)
|
|
147
|
-
.sort((a, b) => parseFloat(b.ts) - parseFloat(a.ts));
|
|
148
|
-
return (0, utils_1.getFirstFiveOrAll)(processedMessages);
|
|
149
|
-
}),
|
|
150
68
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
151
69
|
var _a, _b;
|
|
152
70
|
const payloadBody = context.payload.body;
|
|
153
71
|
const channels = (_a = context.propsValue.channels) !== null && _a !== void 0 ? _a : [];
|
|
154
72
|
const commands = (_b = context.propsValue.commands) !== null && _b !== void 0 ? _b : [];
|
|
155
73
|
const user = context.propsValue.user;
|
|
74
|
+
// check if it's channel message
|
|
75
|
+
if (payloadBody.event.channel_type !== 'channel') {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
156
78
|
// Check if we should process this channel
|
|
157
79
|
if (!(channels.length === 0 || channels.includes(payloadBody.event.channel))) {
|
|
158
80
|
return [];
|
|
@@ -163,7 +85,7 @@ exports.newCommand = (0, pieces_framework_1.createTrigger)({
|
|
|
163
85
|
}
|
|
164
86
|
// Check for mention and parse command
|
|
165
87
|
if (user && payloadBody.event.text) {
|
|
166
|
-
const parsedCommand = parseCommand(payloadBody.event.text, user, commands);
|
|
88
|
+
const parsedCommand = (0, utils_1.parseCommand)(payloadBody.event.text, user, commands);
|
|
167
89
|
if (parsedCommand && commands.includes(parsedCommand.command)) {
|
|
168
90
|
// Return event with parsed command
|
|
169
91
|
return [
|
|
@@ -174,32 +96,4 @@ exports.newCommand = (0, pieces_framework_1.createTrigger)({
|
|
|
174
96
|
return [];
|
|
175
97
|
}),
|
|
176
98
|
});
|
|
177
|
-
/**
|
|
178
|
-
* Parse a message text to extract command and arguments
|
|
179
|
-
*/
|
|
180
|
-
function parseCommand(text, botUserId, validCommands) {
|
|
181
|
-
if (!botUserId) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
// Check if the message mentions the bot
|
|
185
|
-
const mentionRegex = new RegExp(`<@${botUserId}>\\s+(.+)`, 's');
|
|
186
|
-
const mentionMatch = text.match(mentionRegex);
|
|
187
|
-
if (!mentionMatch) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
// Extract the text after the mention
|
|
191
|
-
const commandText = mentionMatch[1].trim();
|
|
192
|
-
// Split into command and arguments (first word is command, rest are args)
|
|
193
|
-
const parts = commandText.split(/\s+/);
|
|
194
|
-
const command = parts[0].toLowerCase();
|
|
195
|
-
const args = parts.slice(1);
|
|
196
|
-
// Check if it's a valid command
|
|
197
|
-
if (!validCommands.includes(command)) {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
return {
|
|
201
|
-
command,
|
|
202
|
-
args,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
99
|
//# sourceMappingURL=new-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-command.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-command.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,2CAA8E;AAC9E,8BAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"new-command.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-command.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,2CAA8E;AAC9E,8BAAmC;AACnC,2CAA+C;AAElC,QAAA,UAAU,GAAG,IAAA,gCAAa,EAAC;IACtC,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EACT,oFAAoF;IACtF,KAAK,EAAE;QACL,IAAI,EAAE,8BAAsB;QAC5B,IAAI,EAAE,cAAM;QACZ,QAAQ,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACvB,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,iFAAiF;YACnF,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,CAAC,MAAM,CAAC;SACvB,CAA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AAA;CACF,CAAC,CAAC"}
|
|
@@ -4,34 +4,6 @@ exports.newDirectMessageTrigger = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const __1 = require("../../");
|
|
7
|
-
const sampleData = {
|
|
8
|
-
user: 'U06C9507WGH',
|
|
9
|
-
type: 'message',
|
|
10
|
-
ts: '1741787044.231539',
|
|
11
|
-
client_msg_id: '6f6e5257-6c39-40d8-bf22-f2bc2b7d8de9',
|
|
12
|
-
text: 'Test Message',
|
|
13
|
-
team: 'T06BTHUEFFF',
|
|
14
|
-
blocks: [
|
|
15
|
-
{
|
|
16
|
-
type: 'rich_text',
|
|
17
|
-
block_id: 'oUF4b',
|
|
18
|
-
elements: [
|
|
19
|
-
{
|
|
20
|
-
type: 'rich_text_section',
|
|
21
|
-
elements: [
|
|
22
|
-
{
|
|
23
|
-
type: 'text',
|
|
24
|
-
text: 'Test Message',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
channel: 'D06BFVAL8CF',
|
|
32
|
-
event_ts: '1741787044.231539',
|
|
33
|
-
channel_type: 'im',
|
|
34
|
-
};
|
|
35
7
|
exports.newDirectMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
36
8
|
auth: __1.slackAuth,
|
|
37
9
|
name: 'new-direct-message',
|
|
@@ -50,7 +22,7 @@ exports.newDirectMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
50
22
|
}),
|
|
51
23
|
},
|
|
52
24
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
53
|
-
sampleData:
|
|
25
|
+
sampleData: undefined,
|
|
54
26
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
55
27
|
var _a;
|
|
56
28
|
// Older OAuth2 has team_id, newer has team.id
|
|
@@ -63,11 +35,6 @@ exports.newDirectMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
63
35
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
64
36
|
// Ignored
|
|
65
37
|
}),
|
|
66
|
-
test(context) {
|
|
67
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return [sampleData];
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
38
|
run(context) {
|
|
72
39
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
40
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-direct-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-direct-message.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,8BAAmC;
|
|
1
|
+
{"version":3,"file":"new-direct-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-direct-message.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,8BAAmC;AAItB,QAAA,uBAAuB,GAAG,IAAA,gCAAa,EAAC;IACpD,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,iEAAiE;IAC9E,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACnB,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrC,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACnB,CAAC;KACF;IACD,IAAI,EAAE,kCAAe,CAAC,WAAW;IACjC,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,CAAO,OAAO,EAAE,EAAE;;QAC3B,8CAA8C;QAC9C,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC3B,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,eAAe,EAAE,MAAM;SACvB,CAAC,CAAC;IACJ,CAAC,CAAA;IACD,SAAS,EAAE,CAAO,OAAO,EAAE,EAAE;QAC5B,UAAU;IACX,CAAC,CAAA;IAEK,GAAG,CAAC,OAAO;;;YAChB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAmB,CAAC;YACxD,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,0CAAE,EAAE,CAAC;YAEpD,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;gBAC7C,OAAO,EAAE,CAAC;YACX,CAAC;YAED,yBAAyB;YACzB,IACC,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC3D,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EAC3E,CAAC;gBACF,OAAO,EAAE,CAAC;YACX,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newMentionInDirectMessageTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
3
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
5
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
7
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
8
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
9
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
10
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
11
|
+
user: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
12
|
+
ignoreBots: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
13
|
+
ignoreSelfMessages: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newMentionInDirectMessageTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const __1 = require("../../");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
exports.newMentionInDirectMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
9
|
+
auth: __1.slackAuth,
|
|
10
|
+
name: 'new-mention-in-direct-message',
|
|
11
|
+
displayName: 'New Mention in Direct Message',
|
|
12
|
+
description: 'Triggers when a username is mentioned in a direct message channel.',
|
|
13
|
+
props: {
|
|
14
|
+
user: props_1.userId,
|
|
15
|
+
ignoreBots: pieces_framework_1.Property.Checkbox({
|
|
16
|
+
displayName: 'Ignore Bot Messages ?',
|
|
17
|
+
required: true,
|
|
18
|
+
defaultValue: false,
|
|
19
|
+
}),
|
|
20
|
+
ignoreSelfMessages: pieces_framework_1.Property.Checkbox({
|
|
21
|
+
displayName: 'Ignore Message from Yourself ?',
|
|
22
|
+
required: true,
|
|
23
|
+
defaultValue: false,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
27
|
+
sampleData: undefined,
|
|
28
|
+
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
var _a;
|
|
30
|
+
// Older OAuth2 has team_id, newer has team.id
|
|
31
|
+
const teamId = (_a = context.auth.data['team_id']) !== null && _a !== void 0 ? _a : context.auth.data['team']['id'];
|
|
32
|
+
context.app.createListeners({
|
|
33
|
+
events: ['message'],
|
|
34
|
+
identifierValue: teamId,
|
|
35
|
+
});
|
|
36
|
+
}),
|
|
37
|
+
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
// Ignored
|
|
39
|
+
}),
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const payloadBody = context.payload.body;
|
|
44
|
+
const userId = (_a = context.auth.data['authed_user']) === null || _a === void 0 ? void 0 : _a.id;
|
|
45
|
+
if (payloadBody.event.channel_type !== 'im') {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
// check for bot messages
|
|
49
|
+
if ((context.propsValue.ignoreBots && payloadBody.event.bot_id) ||
|
|
50
|
+
(context.propsValue.ignoreSelfMessages &&
|
|
51
|
+
payloadBody.event.user === userId)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
//check for mention
|
|
55
|
+
if (context.propsValue.user &&
|
|
56
|
+
((_b = payloadBody.event.text) === null || _b === void 0 ? void 0 : _b.includes(`<@${context.propsValue.user}>`))) {
|
|
57
|
+
return [payloadBody.event];
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=new-mention-in-direct-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-mention-in-direct-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-mention-in-direct-message.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,8BAAmC;AACnC,2CAAyC;AAE5B,QAAA,gCAAgC,GAAG,IAAA,gCAAa,EAAC;IAC5D,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EACT,oEAAoE;IACtE,KAAK,EAAE;QACL,IAAI,EAAE,cAAM;QACZ,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACpC,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACD,IAAI,EAAE,kCAAe,CAAC,WAAW;IACjC,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,CAAO,OAAO,EAAE,EAAE;;QAC1B,8CAA8C;QAC9C,MAAM,MAAM,GACV,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC1B,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,eAAe,EAAE,MAAM;SACxB,CAAC,CAAC;IACL,CAAC,CAAA;IACD,SAAS,EAAE,CAAO,OAAO,EAAE,EAAE;QAC3B,UAAU;IACZ,CAAC,CAAA;IAEK,GAAG,CAAC,OAAO;;;YACf,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAmB,CAAC;YACxD,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,0CAAE,EAAE,CAAC;YAEpD,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;gBAC5C,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,yBAAyB;YACzB,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC3D,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB;oBACpC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EACpC,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,mBAAmB;YACnB,IACE,OAAO,CAAC,UAAU,CAAC,IAAI;iBACvB,MAAA,WAAW,CAAC,KAAK,CAAC,IAAI,0CAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAA,EACjE,CAAC;gBACD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -5,45 +5,10 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const props_1 = require("../common/props");
|
|
7
7
|
const __1 = require("../../");
|
|
8
|
-
const web_api_1 = require("@slack/web-api");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
const utils_1 = require("../common/utils");
|
|
11
|
-
const sampleData = {
|
|
12
|
-
client_msg_id: '2767cf34-0651-44e0-b9c8-1b167ce9b7a9',
|
|
13
|
-
type: 'message',
|
|
14
|
-
text: 'heeeelllo\n<@U07BN652T52>',
|
|
15
|
-
user: 'U037UG6FKPU',
|
|
16
|
-
ts: '1678231735.586539',
|
|
17
|
-
blocks: [
|
|
18
|
-
{
|
|
19
|
-
type: 'rich_text',
|
|
20
|
-
block_id: 'jCFSh',
|
|
21
|
-
elements: [
|
|
22
|
-
{
|
|
23
|
-
type: 'rich_text_section',
|
|
24
|
-
elements: [
|
|
25
|
-
{
|
|
26
|
-
type: 'text',
|
|
27
|
-
text: 'heeeelllo\n',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'user',
|
|
31
|
-
user_id: 'U07BN652T52',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
team: 'T037MS4FGDC',
|
|
39
|
-
channel: 'C037RTX2ZDM',
|
|
40
|
-
event_ts: '1678231735.586539',
|
|
41
|
-
channel_type: 'channel',
|
|
42
|
-
};
|
|
43
8
|
exports.newMention = (0, pieces_framework_1.createTrigger)({
|
|
44
9
|
auth: __1.slackAuth,
|
|
45
10
|
name: 'new_mention',
|
|
46
|
-
displayName: 'New Mention',
|
|
11
|
+
displayName: 'New Mention in Channel',
|
|
47
12
|
description: 'Triggers when a username is mentioned.',
|
|
48
13
|
props: {
|
|
49
14
|
info: props_1.multiSelectChannelInfo,
|
|
@@ -80,7 +45,7 @@ exports.newMention = (0, pieces_framework_1.createTrigger)({
|
|
|
80
45
|
}),
|
|
81
46
|
},
|
|
82
47
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
83
|
-
sampleData:
|
|
48
|
+
sampleData: undefined,
|
|
84
49
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
85
50
|
var _a;
|
|
86
51
|
// Older OAuth2 has team_id, newer has team.id
|
|
@@ -93,32 +58,14 @@ exports.newMention = (0, pieces_framework_1.createTrigger)({
|
|
|
93
58
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
94
59
|
// Ignored
|
|
95
60
|
}),
|
|
96
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
-
const channels = context.propsValue.channels;
|
|
98
|
-
if (!channels || (Array.isArray(channels) && channels.length === 0)) {
|
|
99
|
-
return [sampleData];
|
|
100
|
-
}
|
|
101
|
-
const client = new web_api_1.WebClient(context.auth.access_token);
|
|
102
|
-
const response = yield client.conversations.history({
|
|
103
|
-
channel: channels[0],
|
|
104
|
-
limit: 100,
|
|
105
|
-
});
|
|
106
|
-
if (!response.messages) {
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
const messages = response.messages
|
|
110
|
-
.filter((message) => !(0, shared_1.isNil)(message.ts))
|
|
111
|
-
.filter((message) => message.text && message.text.includes(`<@${context.propsValue.user}>`))
|
|
112
|
-
.filter((message) => !(context.propsValue.ignoreBots && message.bot_id))
|
|
113
|
-
.map((message) => {
|
|
114
|
-
return Object.assign(Object.assign({}, message), { channel: channels[0], event_ts: '1678231735.586539', channel_type: 'channel' });
|
|
115
|
-
}).sort((a, b) => parseFloat(b.ts) - parseFloat(a.ts));
|
|
116
|
-
return (0, utils_1.getFirstFiveOrAll)(messages);
|
|
117
|
-
}),
|
|
118
61
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
-
var _a;
|
|
62
|
+
var _a, _b;
|
|
120
63
|
const payloadBody = context.payload.body;
|
|
121
|
-
const channels = context.propsValue.channels;
|
|
64
|
+
const channels = (_a = context.propsValue.channels) !== null && _a !== void 0 ? _a : [];
|
|
65
|
+
// check if it's channel message
|
|
66
|
+
if (payloadBody.event.channel_type !== 'channel') {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
122
69
|
if (channels.length === 0 || channels.includes(payloadBody.event.channel)) {
|
|
123
70
|
// check for bot messages
|
|
124
71
|
if (context.propsValue.ignoreBots && payloadBody.event.bot_id) {
|
|
@@ -126,7 +73,7 @@ exports.newMention = (0, pieces_framework_1.createTrigger)({
|
|
|
126
73
|
}
|
|
127
74
|
// check for mention
|
|
128
75
|
if (context.propsValue.user &&
|
|
129
|
-
((
|
|
76
|
+
((_b = payloadBody.event.text) === null || _b === void 0 ? void 0 : _b.includes(`<@${context.propsValue.user}>`))) {
|
|
130
77
|
return [payloadBody.event];
|
|
131
78
|
}
|
|
132
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-mention.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-mention.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,2CAA8E;AAC9E,8BAAmC;
|
|
1
|
+
{"version":3,"file":"new-mention.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-mention.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,2CAA8E;AAC9E,8BAAmC;AAEtB,QAAA,UAAU,GAAG,IAAA,gCAAa,EAAC;IACtC,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,IAAI,EAAE,8BAAsB;QAC5B,IAAI,EAAE,cAAM;QACZ,QAAQ,EAAE,2BAAQ,CAAC,mBAAmB,CAAC;YACrC,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,6FAA6F;YAC/F,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,EAAE;YACR,OAAO;6EAAC,EAAE,IAAI,EAAE;oBACpB,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,OAAO;4BACL,QAAQ,EAAE,IAAI;4B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AAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAClD,OAAO,EAAE,CAAC;QACX,CAAC;QAGC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1E,yBAAyB;YACzB,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAC9D,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,oBAAoB;YACpB,IACE,OAAO,CAAC,UAAU,CAAC,IAAI;iBACvB,MAAA,WAAW,CAAC,KAAK,CAAC,IAAI,0CAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAA,EACjE,CAAC;gBACD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -5,37 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const props_1 = require("../common/props");
|
|
7
7
|
const __1 = require("../../");
|
|
8
|
-
const web_api_1 = require("@slack/web-api");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
const utils_1 = require("../common/utils");
|
|
11
|
-
const sampleData = {
|
|
12
|
-
client_msg_id: '2767cf34-0651-44e0-b9c8-1b167ce9b7a9',
|
|
13
|
-
type: 'message',
|
|
14
|
-
text: 'f',
|
|
15
|
-
user: 'U037UG6FKPU',
|
|
16
|
-
ts: '1678231735.586539',
|
|
17
|
-
blocks: [
|
|
18
|
-
{
|
|
19
|
-
type: 'rich_text',
|
|
20
|
-
block_id: '4CM',
|
|
21
|
-
elements: [
|
|
22
|
-
{
|
|
23
|
-
type: 'rich_text_section',
|
|
24
|
-
elements: [
|
|
25
|
-
{
|
|
26
|
-
type: 'text',
|
|
27
|
-
text: 'f',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
team: 'T037MS4FGDC',
|
|
35
|
-
channel: 'C037RTX2ZDM',
|
|
36
|
-
event_ts: '1678231735.586539',
|
|
37
|
-
channel_type: 'channel',
|
|
38
|
-
};
|
|
39
8
|
exports.newMessageInChannelTrigger = (0, pieces_framework_1.createTrigger)({
|
|
40
9
|
auth: __1.slackAuth,
|
|
41
10
|
name: 'new-message-in-channel',
|
|
@@ -51,7 +20,7 @@ exports.newMessageInChannelTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
51
20
|
}),
|
|
52
21
|
},
|
|
53
22
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
54
|
-
sampleData:
|
|
23
|
+
sampleData: undefined,
|
|
55
24
|
onEnable(context) {
|
|
56
25
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
26
|
var _a;
|
|
@@ -68,32 +37,13 @@ exports.newMessageInChannelTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
68
37
|
// Ignored
|
|
69
38
|
});
|
|
70
39
|
},
|
|
71
|
-
test(context) {
|
|
72
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
if (!context.propsValue.channel) {
|
|
74
|
-
return [sampleData];
|
|
75
|
-
}
|
|
76
|
-
const client = new web_api_1.WebClient(context.auth.access_token);
|
|
77
|
-
const response = yield client.conversations.history({
|
|
78
|
-
channel: context.propsValue.channel,
|
|
79
|
-
limit: 100,
|
|
80
|
-
});
|
|
81
|
-
if (!response.messages) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
const messages = response.messages
|
|
85
|
-
.filter((message) => !(0, shared_1.isNil)(message.ts))
|
|
86
|
-
.filter((message) => !(context.propsValue.ignoreBots && message.bot_id))
|
|
87
|
-
.map((message) => {
|
|
88
|
-
return Object.assign(Object.assign({}, message), { channel: context.propsValue.channel, event_ts: '1678231735.586539', channel_type: 'channel' });
|
|
89
|
-
})
|
|
90
|
-
.sort((a, b) => parseFloat(b.ts) - parseFloat(a.ts));
|
|
91
|
-
return (0, utils_1.getFirstFiveOrAll)(messages);
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
40
|
run(context) {
|
|
95
41
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
96
42
|
const payloadBody = context.payload.body;
|
|
43
|
+
// check if it's channel message
|
|
44
|
+
if (payloadBody.event.channel_type !== 'channel') {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
97
47
|
if (payloadBody.event.channel === context.propsValue.channel) {
|
|
98
48
|
// check for bot messages
|
|
99
49
|
if (context.propsValue.ignoreBots && payloadBody.event.bot_id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-message-in-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-message-in-channel.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,2CAAwE;AACxE,8BAAmC;
|
|
1
|
+
{"version":3,"file":"new-message-in-channel.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-message-in-channel.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,2CAAwE;AACxE,8BAAmC;AAOtB,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACvD,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,0EAA0E;IACvF,KAAK,EAAE;QACN,IAAI,EAAE,+BAAuB;QAC7B,OAAO,EAAE,IAAA,oBAAY,EAAC,IAAI,CAAC;QAC3B,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACnB,CAAC;KACF;IACD,IAAI,EAAE,kCAAe,CAAC,WAAW;IACjC,UAAU,EAAE,SAAS;IACf,QAAQ,CAAC,OAAO;;;YACrB,8CAA8C;YAC9C,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/E,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;gBAC3B,MAAM,EAAE,CAAC,SAAS,CAAC;gBACnB,eAAe,EAAE,MAAM;aACvB,CAAC,CAAC;QACJ,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACtB,UAAU;QACX,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YAChB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAmB,CAAC;YAExD,gCAAgC;YAChC,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBAClD,OAAO,EAAE,CAAC;YACX,CAAC;YAED,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gBAC9D,yBAAyB;gBACzB,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBAC/D,OAAO,EAAE,CAAC;gBACX,CAAC;gBACD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;YAED,OAAO,EAAE,CAAC;QACX,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -4,37 +4,6 @@ exports.newMessageTrigger = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const __1 = require("../../");
|
|
7
|
-
const web_api_1 = require("@slack/web-api");
|
|
8
|
-
const shared_1 = require("@activepieces/shared");
|
|
9
|
-
const utils_1 = require("../common/utils");
|
|
10
|
-
const sampleData = {
|
|
11
|
-
client_msg_id: '2767cf34-0651-44e0-b9c8-1b167ce9b7a9',
|
|
12
|
-
type: 'message',
|
|
13
|
-
text: 'f',
|
|
14
|
-
user: 'U037UG6FKPU',
|
|
15
|
-
ts: '1678231735.586539',
|
|
16
|
-
blocks: [
|
|
17
|
-
{
|
|
18
|
-
type: 'rich_text',
|
|
19
|
-
block_id: '4CM',
|
|
20
|
-
elements: [
|
|
21
|
-
{
|
|
22
|
-
type: 'rich_text_section',
|
|
23
|
-
elements: [
|
|
24
|
-
{
|
|
25
|
-
type: 'text',
|
|
26
|
-
text: 'f',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
team: 'T037MS4FGDC',
|
|
34
|
-
channel: 'C037RTX2ZDM',
|
|
35
|
-
event_ts: '1678231735.586539',
|
|
36
|
-
channel_type: 'channel',
|
|
37
|
-
};
|
|
38
7
|
exports.newMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
39
8
|
auth: __1.slackAuth,
|
|
40
9
|
name: 'new-message',
|
|
@@ -48,7 +17,7 @@ exports.newMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
48
17
|
}),
|
|
49
18
|
},
|
|
50
19
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
51
|
-
sampleData:
|
|
20
|
+
sampleData: undefined,
|
|
52
21
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
22
|
var _a;
|
|
54
23
|
// Older OAuth2 has team_id, newer has team.id
|
|
@@ -61,36 +30,12 @@ exports.newMessageTrigger = (0, pieces_framework_1.createTrigger)({
|
|
|
61
30
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
62
31
|
// Ignored
|
|
63
32
|
}),
|
|
64
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
var _a;
|
|
66
|
-
const client = new web_api_1.WebClient(context.auth.access_token);
|
|
67
|
-
const channelList = yield client.conversations.list({
|
|
68
|
-
types: 'public_channel,private_channel',
|
|
69
|
-
exclude_archived: true,
|
|
70
|
-
limit: 1,
|
|
71
|
-
});
|
|
72
|
-
if (!channelList.channels || channelList.channels.length === 0) {
|
|
73
|
-
return [sampleData];
|
|
74
|
-
}
|
|
75
|
-
const channel = (_a = channelList.channels[0].id) !== null && _a !== void 0 ? _a : '';
|
|
76
|
-
const response = yield client.conversations.history({
|
|
77
|
-
channel: channel,
|
|
78
|
-
limit: 100,
|
|
79
|
-
});
|
|
80
|
-
if (!response.messages) {
|
|
81
|
-
return [sampleData];
|
|
82
|
-
}
|
|
83
|
-
const messages = response.messages
|
|
84
|
-
.filter((message) => !(0, shared_1.isNil)(message.ts))
|
|
85
|
-
.filter((message) => !(context.propsValue.ignoreBots && message.bot_id))
|
|
86
|
-
.map((message) => {
|
|
87
|
-
return Object.assign(Object.assign({}, message), { event_ts: '1678231735.586539', channel_type: 'channel' });
|
|
88
|
-
})
|
|
89
|
-
.sort((a, b) => parseFloat(b.ts) - parseFloat(a.ts));
|
|
90
|
-
return (0, utils_1.getFirstFiveOrAll)(messages);
|
|
91
|
-
}),
|
|
92
33
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
93
34
|
const payloadBody = context.payload.body;
|
|
35
|
+
// check if it's channel message
|
|
36
|
+
if (payloadBody.event.channel_type !== 'channel') {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
94
39
|
// check for bot messages
|
|
95
40
|
if (context.propsValue.ignoreBots && payloadBody.event.bot_id) {
|
|
96
41
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-message.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,8BAAmC;
|
|
1
|
+
{"version":3,"file":"new-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-message.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,8BAAmC;AAEtB,QAAA,iBAAiB,GAAG,IAAA,gCAAa,EAAC;IAC9C,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,KAAK;SACnB,CAAC;KACF;IACD,IAAI,EAAE,kCAAe,CAAC,WAAW;IACjC,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,CAAO,OAAO,EAAE,EAAE;;QAC3B,8CAA8C;QAC9C,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC3B,MAAM,EAAE,CAAC,SAAS,CAAC;YACnB,eAAe,EAAE,MAAM;SACvB,CAAC,CAAC;IACJ,CAAC,CAAA;IACD,SAAS,EAAE,CAAO,OAAO,EAAE,EAAE;QAC5B,UAAU;IACX,CAAC,CAAA;IAED,GAAG,EAAE,CAAO,OAAO,EAAE,EAAE;QACtB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAmB,CAAC;QAExD,gCAAgC;QAChC,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAClD,OAAO,EAAE,CAAC;QACX,CAAC;QAED,yBAAyB;QACzB,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/D,OAAO,EAAE,CAAC;QACX,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAA;CACD,CAAC,CAAC"}
|
|
@@ -5,35 +5,6 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const __1 = require("../../");
|
|
7
7
|
const props_1 = require("../common/props");
|
|
8
|
-
const web_api_1 = require("@slack/web-api");
|
|
9
|
-
const sampleData = {
|
|
10
|
-
client_msg_id: '2767cf34-0651-44e0-b9c8-1b167ce9b7a9',
|
|
11
|
-
type: 'message',
|
|
12
|
-
text: 'f',
|
|
13
|
-
user: 'U037UG6FKPU',
|
|
14
|
-
ts: '1678231735.586539',
|
|
15
|
-
blocks: [
|
|
16
|
-
{
|
|
17
|
-
type: 'rich_text',
|
|
18
|
-
block_id: '4CM',
|
|
19
|
-
elements: [
|
|
20
|
-
{
|
|
21
|
-
type: 'rich_text_section',
|
|
22
|
-
elements: [
|
|
23
|
-
{
|
|
24
|
-
type: 'text',
|
|
25
|
-
text: 'f',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
team: 'T037MS4FGDC',
|
|
33
|
-
channel: 'C037RTX2ZDM',
|
|
34
|
-
event_ts: '1678231735.586539',
|
|
35
|
-
channel_type: 'channel',
|
|
36
|
-
};
|
|
37
8
|
exports.newReactionAdded = (0, pieces_framework_1.createTrigger)({
|
|
38
9
|
auth: __1.slackAuth,
|
|
39
10
|
name: 'new_reaction_added',
|
|
@@ -48,7 +19,7 @@ exports.newReactionAdded = (0, pieces_framework_1.createTrigger)({
|
|
|
48
19
|
channel: (0, props_1.slackChannel)(false),
|
|
49
20
|
},
|
|
50
21
|
type: pieces_framework_1.TriggerStrategy.APP_WEBHOOK,
|
|
51
|
-
sampleData:
|
|
22
|
+
sampleData: undefined,
|
|
52
23
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
24
|
var _a;
|
|
54
25
|
// Older OAuth2 has team_id, newer has team.id
|
|
@@ -61,31 +32,6 @@ exports.newReactionAdded = (0, pieces_framework_1.createTrigger)({
|
|
|
61
32
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
62
33
|
// Ignored
|
|
63
34
|
}),
|
|
64
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
var _a;
|
|
66
|
-
const client = new web_api_1.WebClient((_a = context.auth.data['authed_user']) === null || _a === void 0 ? void 0 : _a.access_token);
|
|
67
|
-
const response = yield client.reactions.list({ limit: 10, full: true });
|
|
68
|
-
if (!response.items) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
return response.items
|
|
72
|
-
.filter((item) => item.type === 'message')
|
|
73
|
-
.map((item) => {
|
|
74
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
-
return {
|
|
76
|
-
type: 'reaction_added',
|
|
77
|
-
user: (_c = (_b = (_a = item.message) === null || _a === void 0 ? void 0 : _a.reactions) === null || _b === void 0 ? void 0 : _b[0].users) === null || _c === void 0 ? void 0 : _c[0],
|
|
78
|
-
reaction: (_e = (_d = item.message) === null || _d === void 0 ? void 0 : _d.reactions) === null || _e === void 0 ? void 0 : _e[0].name,
|
|
79
|
-
item_user: (_f = item.message) === null || _f === void 0 ? void 0 : _f.user,
|
|
80
|
-
item: {
|
|
81
|
-
type: 'message',
|
|
82
|
-
channel: item.channel,
|
|
83
|
-
ts: (_g = item.message) === null || _g === void 0 ? void 0 : _g.ts,
|
|
84
|
-
},
|
|
85
|
-
event_ts: '1360782804.083113',
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
}),
|
|
89
35
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
36
|
const payloadBody = context.payload.body;
|
|
91
37
|
if (context.propsValue.emojis) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-reaction-added.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-reaction-added.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,8BAAmC;AACnC,2CAA+C;
|
|
1
|
+
{"version":3,"file":"new-reaction-added.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/triggers/new-reaction-added.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,8BAAmC;AACnC,2CAA+C;AAIlC,QAAA,gBAAgB,GAAG,IAAA,gCAAa,EAAC;IAC5C,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,oDAAoD;IACjE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACrB,WAAW,EAAE,0BAA0B;YACvC,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC;KAC7B;IACD,IAAI,EAAE,kCAAe,CAAC,WAAW;IACjC,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,CAAO,OAAO,EAAE,EAAE;;QAC1B,8CAA8C;QAC9C,MAAM,MAAM,GACV,MAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,mCAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;YAC1B,MAAM,EAAE,CAAC,gBAAgB,CAAC;YAC1B,eAAe,EAAE,MAAM;SACxB,CAAC,CAAC;IACL,CAAC,CAAA;IACD,SAAS,EAAE,CAAO,OA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