diff --git a/packages/nodes-base/nodes/Slack/FileDescription.ts b/packages/nodes-base/nodes/Slack/FileDescription.ts index e33b9e356e..73c73682b6 100644 --- a/packages/nodes-base/nodes/Slack/FileDescription.ts +++ b/packages/nodes-base/nodes/Slack/FileDescription.ts @@ -239,14 +239,14 @@ export const fileFields = [ description: 'Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.', }, { - displayName: 'TS From', + displayName: 'Timestamp From', name: 'tsFrom', type: 'string', default: '', description: 'Filter files created after this timestamp (inclusive).', }, { - displayName: 'TS To', + displayName: 'Timestamp To', name: 'tsTo', type: 'string', default: '', diff --git a/packages/nodes-base/nodes/Slack/MessageDescription.ts b/packages/nodes-base/nodes/Slack/MessageDescription.ts index 97921c491f..16977b6e28 100644 --- a/packages/nodes-base/nodes/Slack/MessageDescription.ts +++ b/packages/nodes-base/nodes/Slack/MessageDescription.ts @@ -15,6 +15,11 @@ export const messageOperations = [ }, }, options: [ + { + name: 'Get Permalink', + value: 'getPermalink', + description: 'Get Permanent Link of a message', + }, { name: 'Post', value: 'post', @@ -38,6 +43,49 @@ export const messageOperations = [ export const messageFields = [ + /* ----------------------------------------------------------------------- */ + /* message:getPermalink + /* ----------------------------------------------------------------------- */ + { + displayName: 'Channel', + name: 'channelId', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getChannels', + }, + required: true, + default: '', + displayOptions: { + show: { + resource: [ + 'message', + ], + operation: [ + 'getPermalink', + ], + }, + }, + description: 'Channel containing the message.', + }, + { + displayName: 'Timestamp', + name: 'timestamp', + type: 'string', + required: true, + default: '', + displayOptions: { + show: { + resource: [ + 'message', + ], + operation: [ + 'getPermalink', + ], + }, + }, + description: `Timestamp of the message to get permanent link.`, + }, + /* -------------------------------------------------------------------------- */ /* message:post/postEphemeral */ /* -------------------------------------------------------------------------- */ @@ -1631,4 +1679,5 @@ export const messageFields = [ }, ], }, + ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Slack/Slack.node.ts b/packages/nodes-base/nodes/Slack/Slack.node.ts index 105a6b85de..75d597b3fe 100644 --- a/packages/nodes-base/nodes/Slack/Slack.node.ts +++ b/packages/nodes-base/nodes/Slack/Slack.node.ts @@ -103,14 +103,14 @@ export class Slack implements INodeType { description: INodeTypeDescription = { displayName: 'Slack', name: 'slack', - icon: 'file:slack.png', + icon: 'file:slack.svg', group: ['output'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Consume Slack API', defaults: { name: 'Slack', - color: '#BB2244', + color: '#E01E5A', }, inputs: ['main'], outputs: ['main'], @@ -795,6 +795,16 @@ export class Slack implements INodeType { Object.assign(body, updateFields); responseData = await slackApiRequest.call(this, 'POST', '/chat.update', body, qs); } + //https://api.slack.com/methods/chat.getPermalink + if (operation === 'getPermalink') { + const channel = this.getNodeParameter('channelId', i) as string; + const timestamp = this.getNodeParameter('timestamp', i) as string; + const qs = { + channel, + message_ts: timestamp, + }; + responseData = await slackApiRequest.call(this, 'GET', '/chat.getPermalink', {}, qs); + } } if (resource === 'reaction') { const channel = this.getNodeParameter('channelId', i) as string; diff --git a/packages/nodes-base/nodes/Slack/slack.png b/packages/nodes-base/nodes/Slack/slack.png deleted file mode 100644 index ff58f37081..0000000000 Binary files a/packages/nodes-base/nodes/Slack/slack.png and /dev/null differ diff --git a/packages/nodes-base/nodes/Slack/slack.svg b/packages/nodes-base/nodes/Slack/slack.svg new file mode 100644 index 0000000000..a0dd9b585e --- /dev/null +++ b/packages/nodes-base/nodes/Slack/slack.svg @@ -0,0 +1 @@ + \ No newline at end of file