n8n/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts

80 lines
1.7 KiB
TypeScript
Raw Normal View History

import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2020-03-05 15:25:18 -08:00
//https://api.slack.com/authentication/oauth-v2
2020-03-08 15:22:33 -07:00
const userScopes = [
'channels:read',
'channels:write',
2020-03-08 15:22:33 -07:00
'chat:write',
'files:read',
'files:write',
'groups:read',
'im:read',
'mpim:read',
'reactions:read',
'reactions:write',
2020-03-08 15:22:33 -07:00
'stars:read',
'stars:write',
'usergroups:write',
'usergroups:read',
'users.profile:read',
2020-10-22 06:46:03 -07:00
'users.profile:write',
'users:read',
2020-03-15 07:51:49 -07:00
];
2020-03-08 15:22:33 -07:00
2020-03-05 15:25:18 -08:00
export class SlackOAuth2Api implements ICredentialType {
name = 'slackOAuth2Api';
extends = ['oAuth2Api'];
2020-03-05 15:25:18 -08:00
displayName = 'Slack OAuth2 API';
documentationUrl = 'slack';
properties: INodeProperties[] = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'authorizationCode',
},
2020-03-05 15:25:18 -08:00
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden',
2020-03-05 15:25:18 -08:00
default: 'https://slack.com/oauth/v2/authorize',
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
2020-03-05 15:25:18 -08:00
default: 'https://slack.com/api/oauth.v2.access',
},
//https://api.slack.com/scopes
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
2020-03-05 15:25:18 -08:00
default: 'chat:write',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
2020-03-08 15:22:33 -07:00
default: `user_scope=${userScopes.join(' ')}`,
2020-03-05 15:25:18 -08:00
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
2020-03-05 15:25:18 -08:00
default: 'body',
},
feat(Slack Node): Revamp the node with more functionalities in a new version (#4587) * 🔥 Remove useless tooltips * Slack change additional fields to Options in node * 🥅 Add error handeling for out of Scope request * ♻️ Refactor channel visibility * ♻️ refactor user ressource * Update user profile * 🔥 remove JSON parameter * 🔥 remove attchmant json and block json * 🎨 refactors message post * 🎨 refactor ts property into timestamps * 🎨 change action name for messages * ✨ add new operation to message ressouce * ✨ add search backend logic + channel RLC * 🎨 improve timestamp description and plaecholder * 🎨 change timestamp disaplay name * ✨ add RLC for channels * ✨ add versioning * 🐛 Fix imports for versioning * ✨ Add RLC for users when sending messages * ✨ RLC for user presence * ✨ Add json builder for slack blocks * 🐛 Fix option in search query * Add loadoption for search in channels * Fix indentation issue * ✨ Add more scopes to Oauth2 * 🐛 Fix lint issue * 🐛 oauth fix * ✨ Merge user and user profile * ✨ Improve reactions and star resource * ⚡️Merges ephemeral operation into one * ⚡️Merge image and emoji in profile picture * 🐛Fix bug for replying to messages * ⚡️Add username type to User Rlc * 🐛 Fix typo * 🎨 Improves tooltip and naming for ephemeral messages * 🎨 Improve display name and description * ⚡️Add the ability to delete within username channel * 🎨 Add informations on how to use the emojis and add doc * 🎨 Fix typos and improve display names * ✨ Improve FE validation for timestamp * 🎨 Change block description * 🚨 Fix linting * 🚨 More lint fixes * 🐛 Fix timestamps bug * 🐛 Fix timestamp not showing up * 🐛 More small fixes * 🐛 Fix logic error * Add searchable to slack rlc channels and users * Fix lint rules * ⚡️Message Search -> fix limit request using qs count * ⚡️Message Search -> sort by relevance use qs score * Fix messages by username rlc * 🐛 fix messages search all operation * Add error when using username with ephemeral message * 🎨 fix linting errors * 🎨 send message ephemeral error message improvement --------- Co-authored-by: Marcus <marcus@n8n.io>
2023-02-03 08:04:37 -08:00
{
displayName:
'If you get an Invalid Scopes error, make sure you add the correct one <a target="_blank" href="https://docs.n8n.io/integrations/builtin/credentials/slack/#using-oauth">here</a> to your Slack integration',
name: 'notice',
type: 'notice',
default: '',
},
2020-03-05 15:25:18 -08:00
];
}