From 9d62afae034042240ee4c530069b9f84ada74144 Mon Sep 17 00:00:00 2001 From: Jonathan Bennetts Date: Mon, 27 Nov 2023 12:42:38 +0000 Subject: [PATCH 1/2] feat(Slack Node): Add support for getting the profile of a user --- packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts | 5 +++++ packages/nodes-base/nodes/Slack/V2/UserDescription.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts b/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts index 8acdf20354d2b..e29290f76d6d5 100644 --- a/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts +++ b/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts @@ -1172,6 +1172,11 @@ export class SlackV2 implements INodeType { qs.user = this.getNodeParameter('user', i, undefined, { extractValue: true }) as string; responseData = await slackApiRequest.call(this, 'GET', '/users.getPresence', {}, qs); } + if (operation === 'getProfile') { + qs.user = this.getNodeParameter('user', i, undefined, { extractValue: true }) as string; + responseData = await slackApiRequest.call(this, 'GET', '/users.profile.get', {}, qs); + responseData = responseData.profile; + } if (operation === 'updateProfile') { const options = this.getNodeParameter('options', i); const timezone = this.getTimezone(); diff --git a/packages/nodes-base/nodes/Slack/V2/UserDescription.ts b/packages/nodes-base/nodes/Slack/V2/UserDescription.ts index 1ced8d7dae10d..8ffd0c6992cbf 100644 --- a/packages/nodes-base/nodes/Slack/V2/UserDescription.ts +++ b/packages/nodes-base/nodes/Slack/V2/UserDescription.ts @@ -18,6 +18,12 @@ export const userOperations: INodeProperties[] = [ description: 'Get information about a user', action: 'Get information about a user', }, + { + name: "Get User's Profile", + value: 'getProfile', + description: "Get a user's", + action: "Get a user's profile", + }, { name: 'Get Many', value: 'getAll', @@ -54,7 +60,7 @@ export const userFields: INodeProperties[] = [ description: 'The ID of the user to get information about', displayOptions: { show: { - operation: ['info'], + operation: ['info', 'getProfile'], resource: ['user'], }, }, From 7c47afa16533d350a7e8a4eaa37f08c592cf149e Mon Sep 17 00:00:00 2001 From: Jonathan Bennetts Date: Mon, 27 Nov 2023 13:10:04 +0000 Subject: [PATCH 2/2] Lint fix --- .../nodes-base/nodes/Slack/V2/UserDescription.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nodes-base/nodes/Slack/V2/UserDescription.ts b/packages/nodes-base/nodes/Slack/V2/UserDescription.ts index 8ffd0c6992cbf..fc69e0eeb2fe0 100644 --- a/packages/nodes-base/nodes/Slack/V2/UserDescription.ts +++ b/packages/nodes-base/nodes/Slack/V2/UserDescription.ts @@ -18,18 +18,18 @@ export const userOperations: INodeProperties[] = [ description: 'Get information about a user', action: 'Get information about a user', }, - { - name: "Get User's Profile", - value: 'getProfile', - description: "Get a user's", - action: "Get a user's profile", - }, { name: 'Get Many', value: 'getAll', description: 'Get a list of many users', action: 'Get many users', }, + { + name: "Get User's Profile", + value: 'getProfile', + description: "Get a user's", + action: "Get a user's profile", + }, { name: "Get User's Status", value: 'getPresence',