n8n/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts
Ricardo Espinoza 532503b69f
Feature/slack node extended (#1239)
* Added reaction method to message

* Increased limit for channels on getChannels, removed unused fields in the code

* Using own operation for reactions

* Registering reaction fields and operations

* Added Operation "Reaction" to Slack.node.ts

* Fixing variable name for emoji

* now removing reaction on "remove" instead of "add"

* Using GET for reactions.get and passing arguments as query

* Added members operation

* Fixed typo in timestamp

* Added user.info and user.getPresence

* Fixed: wrong operation name

*  Improvements to #1238

*  Add field resolve data when retrieving channel members

*  Minor improvements to Slack-Node

Co-authored-by: Andreas Scherren <ascherren@brightfuture.de>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2020-12-13 10:47:52 +01:00

63 lines
1.3 KiB
TypeScript

import {
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
//https://api.slack.com/authentication/oauth-v2
const userScopes = [
'chat:write',
'files:read',
'files:write',
'groups:read',
'im:read',
'mpim:read',
'reactions:read',
'reactions:write',
'stars:read',
'stars:write',
'users.profile:read',
'users.profile:write',
];
export class SlackOAuth2Api implements ICredentialType {
name = 'slackOAuth2Api';
extends = [
'oAuth2Api',
];
displayName = 'Slack OAuth2 API';
documentationUrl = 'slack';
properties = [
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden' as NodePropertyTypes,
default: 'https://slack.com/oauth/v2/authorize',
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden' as NodePropertyTypes,
default: 'https://slack.com/api/oauth.v2.access',
},
//https://api.slack.com/scopes
{
displayName: 'Scope',
name: 'scope',
type: 'hidden' as NodePropertyTypes,
default: 'chat:write',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes,
default: `user_scope=${userScopes.join(' ')}`,
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden' as NodePropertyTypes,
default: 'body',
},
];
}