n8n/packages/nodes-base/nodes/Slack/V2/ReactionDescription.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

132 lines
2.8 KiB
TypeScript
Raw Normal View History

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
import type { INodeProperties } from 'n8n-workflow';
export const reactionOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['reaction'],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Adds a reaction to a message',
action: 'Add a reaction',
},
{
name: 'Get',
value: 'get',
description: 'Get the reactions of a message',
action: 'Get a reaction',
},
{
name: 'Remove',
value: 'remove',
description: 'Remove a reaction of a message',
action: 'Remove a reaction',
},
],
default: 'add',
},
];
export const reactionFields: INodeProperties[] = [
{
displayName: 'Channel',
name: 'channelId',
type: 'resourceLocator',
default: { mode: 'list', value: '' },
placeholder: 'Select a channel...',
modes: [
{
displayName: 'From List',
name: 'list',
type: 'list',
placeholder: 'Select a channel...',
typeOptions: {
searchListMethod: 'getChannels',
searchable: true,
},
},
{
displayName: 'By ID',
name: 'id',
type: 'string',
validation: [
{
type: 'regex',
properties: {
regex: '[a-zA-Z0-9]{2,}',
errorMessage: 'Not a valid Slack Channel ID',
},
},
],
placeholder: 'C0122KQ70S7E',
},
{
displayName: 'By URL',
name: 'url',
type: 'string',
placeholder: 'https://app.slack.com/client/TS9594PZK/B0556F47Z3A',
validation: [
{
type: 'regex',
properties: {
regex: 'http(s)?://app.slack.com/client/.*/([a-zA-Z0-9]{2,})',
errorMessage: 'Not a valid Slack Channel URL',
},
},
],
extractValue: {
type: 'regex',
regex: 'https://app.slack.com/client/.*/([a-zA-Z0-9]{2,})',
},
},
],
required: true,
displayOptions: {
show: {
resource: ['reaction'],
operation: ['add', 'get', 'remove'],
},
},
description: 'The Slack channel to get the reactions from',
},
{
displayName: 'Message Timestamp',
name: 'timestamp',
required: true,
type: 'number',
default: undefined,
displayOptions: {
show: {
resource: ['reaction'],
operation: ['add', 'get', 'remove'],
},
},
description: 'Timestamp of the message to add, get or remove',
placeholder: '1663233118.856619',
},
{
displayName: 'Emoji Code',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['reaction'],
operation: ['add', 'remove'],
},
},
description:
'Emoji code to use for the message reaction. Use emoji codes like +1, not an actual emoji like 👍. <a target="_blank" href=" https://www.webfx.com/tools/emoji-cheat-sheet/">List of common emoji codes</a>',
placeholder: '+1',
},
];