mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Add chat.getPermalink interface in Slack Nodes.
This commit is contained in:
parent
28d54ed439
commit
2bd05abc3e
|
@ -30,6 +30,11 @@ export const messageOperations = [
|
|||
value: 'update',
|
||||
description: 'Updates a message.',
|
||||
},
|
||||
{
|
||||
name: 'GetPermalink',
|
||||
value: 'getPermalink',
|
||||
description: 'Get Permanent Link of a message',
|
||||
},
|
||||
],
|
||||
default: 'post',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -1631,4 +1636,47 @@ 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[];
|
||||
|
|
|
@ -795,6 +795,13 @@ 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 ts = this.getNodeParameter('messageTs', i) as string;
|
||||
const qs = { channel: channel, message_ts: ts };
|
||||
responseData = await slackApiRequest.call(this, 'GET', '/chat.getPermalink', {}, qs);
|
||||
}
|
||||
}
|
||||
if (resource === 'reaction') {
|
||||
const channel = this.getNodeParameter('channelId', i) as string;
|
||||
|
|
Loading…
Reference in a new issue