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>
This commit is contained in:
Ricardo Espinoza
2020-12-13 04:47:52 -05:00
committed by GitHub
parent 5e56dcb037
commit 532503b69f
11 changed files with 509 additions and 126 deletions

View File

@@ -1,4 +1,6 @@
import { INodeProperties } from 'n8n-workflow';
import {
INodeProperties,
} from 'n8n-workflow';
export const channelOperations = [
{
@@ -63,6 +65,11 @@ export const channelOperations = [
value: 'leave',
description: 'Leaves a conversation.',
},
{
name: 'Member',
value: 'member',
description: 'List members of a conversation.',
},
{
name: 'Open',
value: 'open',
@@ -101,9 +108,9 @@ export const channelOperations = [
export const channelFields = [
/* -------------------------------------------------------------------------- */
/* channel:archive */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:archive */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -125,9 +132,10 @@ export const channelFields = [
required: true,
description: 'The name of the channel to archive.',
},
/* -------------------------------------------------------------------------- */
/* channel:close */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:close */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -149,9 +157,10 @@ export const channelFields = [
required: true,
description: 'The name of the channel to close.',
},
/* -------------------------------------------------------------------------- */
/* channel:create */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -197,9 +206,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:invite */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:invite */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -242,9 +252,10 @@ export const channelFields = [
required: true,
description: 'The ID of the user to invite into channel.',
},
/* -------------------------------------------------------------------------- */
/* channel:get */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -288,9 +299,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:kick */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:kick */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -332,9 +344,10 @@ export const channelFields = [
},
default: '',
},
/* -------------------------------------------------------------------------- */
/* channel:join */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:join */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -356,9 +369,10 @@ export const channelFields = [
},
required: true,
},
/* -------------------------------------------------------------------------- */
/* channel:getAll */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
@@ -451,9 +465,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:history */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:history */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -557,9 +572,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:leave */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:leave */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -581,9 +597,89 @@ export const channelFields = [
required: true,
description: 'The name of the channel to leave.',
},
/* -------------------------------------------------------------------------- */
/* channel:open */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:member */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getChannels',
},
default: '',
displayOptions: {
show: {
operation: [
'member',
],
resource: [
'channel',
],
},
},
required: true,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'member',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 100,
placeholder: 'Limit',
displayOptions: {
show: {
operation: [
'member',
],
resource: [
'channel',
],
returnAll: [
false,
],
},
},
required: false,
},
{
displayName: 'Resolve Data',
name: 'resolveData',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'member',
],
},
},
description: 'By default the response only contain the ID to resource. If this<br />option gets activated it will resolve the data automatically.',
},
/* -------------------------------------------------------------------------- */
/* channel:open */
/* -------------------------------------------------------------------------- */
{
displayName: 'Options',
name: 'options',
@@ -627,9 +723,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:rename */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:rename */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -669,9 +766,10 @@ export const channelFields = [
required: true,
description: 'New name for conversation.',
},
/* -------------------------------------------------------------------------- */
/* channel:replies */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:replies */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -793,9 +891,10 @@ export const channelFields = [
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:setPurpose */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:setPurpose */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -835,9 +934,10 @@ export const channelFields = [
required: true,
description: 'A new, specialer purpose',
},
/* -------------------------------------------------------------------------- */
/* channel:setTopic */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:setTopic */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',
@@ -877,9 +977,10 @@ export const channelFields = [
required: true,
description: 'The new topic string. Does not support formatting or linkification.',
},
/* -------------------------------------------------------------------------- */
/* channel:unarchive */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* channel:unarchive */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel',
name: 'channelId',