mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
@@ -6,15 +6,12 @@ import {
|
|||||||
//https://api.slack.com/authentication/oauth-v2
|
//https://api.slack.com/authentication/oauth-v2
|
||||||
const userScopes = [
|
const userScopes = [
|
||||||
'chat:write',
|
'chat:write',
|
||||||
'conversations:history',
|
|
||||||
'conversations:read',
|
|
||||||
'files:read',
|
'files:read',
|
||||||
'files:write',
|
'files:write',
|
||||||
'stars:read',
|
'stars:read',
|
||||||
'stars:write',
|
'stars:write',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export class SlackOAuth2Api implements ICredentialType {
|
export class SlackOAuth2Api implements ICredentialType {
|
||||||
name = 'slackOAuth2Api';
|
name = 'slackOAuth2Api';
|
||||||
extends = [
|
extends = [
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export const messageFields = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Set the bot\'s user name.',
|
description: 'Set the bot\'s user name. This field will be ignored if you are using a user token.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'JSON parameters',
|
displayName: 'JSON parameters',
|
||||||
@@ -486,26 +486,6 @@ export const messageFields = [
|
|||||||
},
|
},
|
||||||
description: `Timestamp of the message to be updated.`,
|
description: `Timestamp of the message to be updated.`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'As User',
|
|
||||||
name: 'as_user',
|
|
||||||
type: 'boolean',
|
|
||||||
default: false,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
authentication: [
|
|
||||||
'accessToken',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'update'
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'message',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
description: 'Pass true to update the message as the authed user. Bot users in this context are considered authed users.',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
name: 'updateFields',
|
name: 'updateFields',
|
||||||
|
|||||||
@@ -454,6 +454,10 @@ export class Slack implements INodeType {
|
|||||||
body.username = this.getNodeParameter('username', i) as string;
|
body.username = this.getNodeParameter('username', i) as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore body.as_user as it's deprecated
|
||||||
|
|
||||||
|
delete body.as_user;
|
||||||
|
|
||||||
if (!jsonParameters) {
|
if (!jsonParameters) {
|
||||||
const attachments = this.getNodeParameter('attachments', i, []) as unknown as Attachment[];
|
const attachments = this.getNodeParameter('attachments', i, []) as unknown as Attachment[];
|
||||||
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[];
|
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[];
|
||||||
@@ -691,10 +695,6 @@ export class Slack implements INodeType {
|
|||||||
ts,
|
ts,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (authentication === 'accessToken') {
|
|
||||||
body.as_user = this.getNodeParameter('as_user', i) as boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The node does save the fields data differently than the API
|
// The node does save the fields data differently than the API
|
||||||
// expects so fix the data befre we send the request
|
// expects so fix the data befre we send the request
|
||||||
for (const attachment of attachments) {
|
for (const attachment of attachments) {
|
||||||
|
|||||||
Reference in New Issue
Block a user