@activepieces/piece-slack 0.16.5 → 0.17.0
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 +1 -1
- package/src/i18n/translation.json +10 -0
- package/src/lib/actions/update-user-groups.d.ts.map +1 -1
- package/src/lib/actions/update-user-groups.js +5 -4
- package/src/lib/actions/update-user-groups.js.map +1 -1
- package/src/lib/auth.d.ts.map +1 -1
- package/src/lib/auth.js +2 -1
- package/src/lib/auth.js.map +1 -1
package/package.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"Set Channel Topic": "Set Channel Topic",
|
|
26
26
|
"Get Message by Timestamp": "Get Message by Timestamp",
|
|
27
27
|
"Invite User to Channel": "Invite User to Channel",
|
|
28
|
+
"Get User Group by Handle": "Get User Group by Handle",
|
|
29
|
+
"Update User Group Members": "Update User Group Members",
|
|
28
30
|
"Custom API Call": "Custom API Call",
|
|
29
31
|
"Add an emoji reaction to a message.": "Add an emoji reaction to a message.",
|
|
30
32
|
"Send message to a user": "Send message to a user",
|
|
@@ -51,6 +53,8 @@
|
|
|
51
53
|
"Sets the topic on a selected channel.": "Sets the topic on a selected channel.",
|
|
52
54
|
"Retrieves a specific message from a channel history using the message's timestamp.": "Retrieves a specific message from a channel history using the message's timestamp.",
|
|
53
55
|
"Invites an existing User to an existing channel.": "Invites an existing User to an existing channel.",
|
|
56
|
+
"Finds a Slack user group by its handle (e.g., @user-group) and returns its details. To mention this group in a message, map the returned ID using the syntax <!subteam^ID>. Read more: https://api.slack.com/reference/surfaces/formatting#mentioning-groups": "Finds a Slack user group by its handle (e.g., @user-group) and returns its details. To mention this group in a message, map the returned ID using the syntax <!subteam^ID>. Read more: https://api.slack.com/reference/surfaces/formatting#mentioning-groups",
|
|
57
|
+
"Add users to or overwrite the member list of a Slack user group.": "Add users to or overwrite the member list of a Slack user group.",
|
|
54
58
|
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
|
55
59
|
"Markdown": "Markdown",
|
|
56
60
|
"Channel": "Channel",
|
|
@@ -93,6 +97,9 @@
|
|
|
93
97
|
"Markdown text": "Markdown text",
|
|
94
98
|
"Thread ts": "Thread ts",
|
|
95
99
|
"Topic": "Topic",
|
|
100
|
+
"Group Handle": "Group Handle",
|
|
101
|
+
"User IDs": "User IDs",
|
|
102
|
+
"Append to existing members?": "Append to existing members?",
|
|
96
103
|
"Method": "Method",
|
|
97
104
|
"Headers": "Headers",
|
|
98
105
|
"Query Parameters": "Query Parameters",
|
|
@@ -131,6 +138,9 @@
|
|
|
131
138
|
"Emoji shortname (standard or custom), e.g. :tada: or :train:": "Emoji shortname (standard or custom), e.g. :tada: or :train:",
|
|
132
139
|
"Unix timestamp - if not set, the status will not expire": "Unix timestamp - if not set, the status will not expire",
|
|
133
140
|
"Provide the ts (timestamp) value of the **parent** message to retrieve replies of this message. Do not use the ts value of the reply itself; use its parent instead. For example `1710304378.475129`.Alternatively, you can easily obtain the message link by clicking on the three dots next to the parent message and selecting the `Copy link` option.": "Provide the ts (timestamp) value of the **parent** message to retrieve replies of this message. Do not use the ts value of the reply itself; use its parent instead. For example `1710304378.475129`.Alternatively, you can easily obtain the message link by clicking on the three dots next to the parent message and selecting the `Copy link` option.",
|
|
141
|
+
"Group handle without the leading @": "Group handle without the leading @",
|
|
142
|
+
"The list of Slack User IDs to update this group with. Leave empty to clear the group (if not appending).": "The list of Slack User IDs to update this group with. Leave empty to clear the group (if not appending).",
|
|
143
|
+
"If checked, these users will be added to the current group. If unchecked, the current group members will be completely replaced by these users.": "If checked, these users will be added to the current group. If unchecked, the current group members will be completely replaced by these users.",
|
|
134
144
|
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
|
135
145
|
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
|
|
136
146
|
"Use user token instead of bot token": "Use user token instead of bot token",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-user-groups.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-user-groups.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;;;;;
|
|
1
|
+
{"version":3,"file":"update-user-groups.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-user-groups.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;;;;;EA0DjC,CAAC"}
|
|
@@ -32,13 +32,14 @@ exports.updateGroupUsersAction = (0, pieces_framework_1.createAction)({
|
|
|
32
32
|
run(context) {
|
|
33
33
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
var _a;
|
|
35
|
-
const
|
|
36
|
-
const
|
|
35
|
+
const auth = context.auth;
|
|
36
|
+
const botClient = new web_api_1.WebClient((0, auth_helpers_1.getBotToken)(auth));
|
|
37
|
+
const userClient = new web_api_1.WebClient((0, auth_helpers_1.requireUserToken)(auth));
|
|
37
38
|
const searchHandle = context.propsValue.handle.replace('@', '').toLowerCase();
|
|
38
39
|
const rawUserIds = (context.propsValue.userIds || []);
|
|
39
40
|
const userIds = rawUserIds.filter((id) => id && id.trim() !== '');
|
|
40
41
|
const appendUsers = context.propsValue.appendUsers;
|
|
41
|
-
const listResponse = yield
|
|
42
|
+
const listResponse = yield botClient.usergroups.list({ include_users: true });
|
|
42
43
|
const group = (_a = listResponse.usergroups) === null || _a === void 0 ? void 0 : _a.find((g) => g.handle && g.handle.toLowerCase() === searchHandle);
|
|
43
44
|
if (!group || !group.id) {
|
|
44
45
|
throw new Error(`User group with handle '@${searchHandle}' not found.`);
|
|
@@ -49,7 +50,7 @@ exports.updateGroupUsersAction = (0, pieces_framework_1.createAction)({
|
|
|
49
50
|
finalUserIds = Array.from(new Set([...existingUsers, ...userIds]));
|
|
50
51
|
}
|
|
51
52
|
const usersString = finalUserIds.join(', ');
|
|
52
|
-
const updateResponse = yield
|
|
53
|
+
const updateResponse = yield userClient.usergroups.users.update({
|
|
53
54
|
usergroup: group.id,
|
|
54
55
|
users: usersString,
|
|
55
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-user-groups.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-user-groups.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAoC;AACpC,4CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"update-user-groups.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-user-groups.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAoC;AACpC,4CAA2C;AAC3C,yDAAuF;AAE1E,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACtB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,0GAA0G;YACvH,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,6BAA6B;YAC1C,WAAW,EAAE,iJAAiJ;YAC9J,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;SACnB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAsB,CAAC;YAC5C,MAAM,SAAS,GAAG,IAAI,mBAAS,CAAC,IAAA,0BAAW,EAAC,IAAI,CAAC,CAAC,CAAC;YACnD,MAAM,UAAU,GAAG,IAAI,mBAAS,CAAC,IAAA,+BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;YACzD,MAAM,YAAY,GAAG,OAAO,CAAC,UA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K,CAAC,EAAE;gBACnB,KAAK,EAAE,WAAW;aACnB,CAAC,CAAC;YAEH,OAAO,cAAc,CAAC;QACxB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,+GAuC1B,CAAC;AAwCH,eAAO,MAAM,SAAS;;;KAAqC,CAAC"}
|
package/src/lib/auth.js
CHANGED
|
@@ -6,7 +6,7 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
exports.slackOAuth2Auth = pieces_framework_1.PieceAuth.OAuth2({
|
|
8
8
|
description: 'Authenticate via a Slack OAuth flow.',
|
|
9
|
-
authUrl: 'https://slack.com/oauth/v2/authorize?user_scope=search:read,users.profile:write,reactions:read,reactions:write,im:history,stars:read,channels:write,groups:write,im:write,mpim:write,channels:write.invites,groups:write.invites,channels:history,groups:history,chat:write,users:read',
|
|
9
|
+
authUrl: 'https://slack.com/oauth/v2/authorize?user_scope=search:read,users.profile:write,reactions:read,reactions:write,im:history,stars:read,channels:write,groups:write,im:write,mpim:write,channels:write.invites,groups:write.invites,channels:history,groups:history,chat:write,users:read,usergroups:write',
|
|
10
10
|
tokenUrl: 'https://slack.com/api/oauth.v2.access',
|
|
11
11
|
required: true,
|
|
12
12
|
scope: [
|
|
@@ -30,6 +30,7 @@ exports.slackOAuth2Auth = pieces_framework_1.PieceAuth.OAuth2({
|
|
|
30
30
|
'users:read.email',
|
|
31
31
|
'reactions:write',
|
|
32
32
|
'usergroups:read',
|
|
33
|
+
'usergroups:write',
|
|
33
34
|
'chat:write.customize',
|
|
34
35
|
'links:read',
|
|
35
36
|
'links:write',
|
package/src/lib/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAExD,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC9C,WAAW,EACT,sCAAsC;IACxC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAExD,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC9C,WAAW,EACT,sCAAsC;IACxC,OAAO,EACL,ySAAyS;IAC3S,QAAQ,EAAE,uCAAuC;IACjD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,eAAe;QACf,iBAAiB;QACjB,kBAAkB;QAClB,YAAY;QACZ,aAAa;QACb,cAAc;QACd,gBAAgB;QAChB,gBAAgB;QAChB,WAAW;QACX,YAAY;QACZ,cAAc;QACd,UAAU;QACV,SAAS;QACT,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;QACjB,kBAAkB;QAClB,sBAAsB;QACtB,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,oBAAoB;QACpB,wBAAwB;QACxB,sBAAsB;QACtB,eAAe;QACf,6BAA6B;KAC9B;CACF,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,QAAQ,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC7B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,sDAAsD;YACnE,QAA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