Skip to content

Commit

Permalink
slack SendChannelMessage + SendPrivateChannelMessage components fix, …
Browse files Browse the repository at this point in the history
…SendChannelMessage update
  • Loading branch information
ZbynekPelunek committed Oct 3, 2024
1 parent c2bb130 commit f82d16c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ module.exports = {

async receive(context) {

let { channelId } = context.properties;
let { text } = context.messages.message.content;
let client = commons.getSlackAPIClient(context.auth.accessToken);
const { channelId, text } = context.messages.in.content;
//const { text } = context.messages.in.content;
const client = commons.getSlackAPIClient(context.auth.accessToken);

context.log('channel ID: ', channelId);
context.log('message text: ', text);

try {
const message = await client.sendMessage(channelId, text);
Expand Down
72 changes: 29 additions & 43 deletions src/appmixer/slack/list/SendChannelMessage/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,52 @@
"schema": {
"type": "object",
"properties": {
"channelId": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"channelId",
"text"
]
},
"inspector": {
"inputs": {
"channelId": {
"type": "select",
"group": "config",
"label": "Channel",
"index": 1,
"source": {
"url": "/component/appmixer/slack/list/ListPublicChannels?outPort=channels",
"data": {
"transform": "./transformers#channelsToSelectArray"
}
},
"attrs": {
"label": {
"data-tooltip": "Select a public channel."
}
}
},
"text": {
"type": "textarea",
"group": "transformation",
"label": "Message",
"index": 1
"index": 2
}
},
"groups": {
"config": {
"label": "Configuration",
"index": 1
},
"transformation": {
"label": "Transformation",
"index": 1
"index": 2
}
}
}
Expand Down Expand Up @@ -77,44 +102,5 @@
}
]
}
],
"properties": {
"schema": {
"properties": {
"channelId": {
"type": "string"
}
},
"required": [
"channelId"
]
},
"inspector": {
"inputs": {
"channelId": {
"type": "select",
"group": "config",
"label": "Channel",
"index": 1,
"source": {
"url": "/component/appmixer/slack/list/ListPublicChannels?outPort=channels",
"data": {
"transform": "./transformers#channelsToSelectArray"
}
},
"attrs": {
"label": {
"data-tooltip": "Select a public channel."
}
}
}
},
"groups": {
"config": {
"label": "Configuration",
"index": 1
}
}
}
}
}
]
}
109 changes: 64 additions & 45 deletions src/appmixer/slack/list/SendPrivateChannelMessage/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,52 @@
"schema": {
"type": "object",
"properties": {
"text": { "type": "string" }
"channelId": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"channelId",
"text"
]
},
"inspector": {
"inputs": {
"channelId": {
"type": "select",
"group": "config",
"label": "Channel",
"index": 1,
"source": {
"url": "/component/appmixer/slack/list/ListPrivateChannels?outPort=channels",
"data": {
"transform": "./transformers#channelsToSelectArray"
}
},
"attrs": {
"label": {
"data-tooltip": "Select a private channel."
}
}
},
"text": {
"type": "textarea",
"group": "transformation",
"label": "Message",
"index": 1
"index": 2
}
},
"groups": {
"config": {
"label": "Configuration",
"index": 1
},
"transformation": {
"label": "Transformation",
"index": 1
"index": 2
}
}
}
Expand All @@ -53,50 +80,42 @@
{
"name": "newMessage",
"options": [
{ "label": "Message Timestamp", "value": "ts", "schema": { "type": "string" } },
{ "label": "Message Type", "value": "type", "schema": { "type": "string" } },
{ "label": "Text", "value": "text", "schema": { "type": "string" } },
{ "label": "User", "value": "user", "schema": { "type": "string" } },
{ "label": "Bot ID", "value": "bot_id", "schema": { "type": "string" } }

]
}
],
"properties": {
"schema": {
"properties": {
"channelId": { "type": "string" }
},
"required": [
"channelId"
]
},
"inspector": {
"inputs": {
"channelId": {
"type": "select",
"group": "config",
"label": "Channel",
"index": 1,
"source": {
"url": "/component/appmixer/slack/list/ListPrivateChannels?outPort=channels",
"data": {
"transform": "./transformers#channelsToSelectArray"
{
"label": "Message Timestamp",
"value": "ts",
"schema": {
"type": "string"
}
},
"attrs": {
"label": {
"data-tooltip": "Select a private channel."
{
"label": "Message Type",
"value": "type",
"schema": {
"type": "string"
}
},
{
"label": "Text",
"value": "text",
"schema": {
"type": "string"
}
},
{
"label": "User",
"value": "user",
"schema": {
"type": "string"
}
},
{
"label": "Bot ID",
"value": "bot_id",
"schema": {
"type": "string"
}
}
}
},
"groups": {
"config": {
"label": "Configuration",
"index": 1
}
]
}
}
}
}
]
}

0 comments on commit f82d16c

Please sign in to comment.