Minor improvements to Slack:getPermalink

This commit is contained in:
Jan Oberhauser 2021-01-23 12:17:38 +01:00
parent 39fd7dc8ce
commit 09f075cc5a
3 changed files with 55 additions and 51 deletions

View file

@ -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: '',

View file

@ -15,6 +15,11 @@ export const messageOperations = [
},
},
options: [
{
name: 'Get Permalink',
value: 'getPermalink',
description: 'Get Permanent Link of a message',
},
{
name: 'Post',
value: 'post',
@ -30,11 +35,6 @@ export const messageOperations = [
value: 'update',
description: 'Updates a message.',
},
{
name: 'Get Permalink',
value: 'getPermalink',
description: 'Get Permanent Link of a message',
},
],
default: 'post',
description: 'The operation to perform.',
@ -43,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 */
/* -------------------------------------------------------------------------- */
@ -1637,46 +1680,4 @@ 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 to be updated.',
},
{
displayName: 'TS',
name: 'messageTs',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'getPermalink',
],
},
},
description: `Timestamp of the message to get permanent link.`,
},
] as INodeProperties[];

View file

@ -798,8 +798,11 @@ export class Slack implements INodeType {
//https://api.slack.com/methods/chat.getPermalink
if (operation === 'getPermalink') {
const channel = this.getNodeParameter('channelId', i) as string;
const ts = this.getNodeParameter('messageTs', i) as string;
const qs = { channel, message_ts: ts };
const timestamp = this.getNodeParameter('timestamp', i) as string;
const qs = {
channel,
message_ts: timestamp,
};
responseData = await slackApiRequest.call(this, 'GET', '/chat.getPermalink', {}, qs);
}
}