Files
automatisch/packages/backend/src/apps/mattermost/actions/send-a-message-to-channel/index.js
2024-01-05 17:44:21 +01:00

43 lines
951 B
JavaScript

import defineAction from '../../../../helpers/define-action.js';
import postMessage from './post-message.js';
export default defineAction({
name: 'Send a message to channel',
key: 'sendMessageToChannel',
description: 'Sends a message to a channel you specify.',
arguments: [
{
label: 'Channel',
key: 'channel',
type: 'dropdown',
required: true,
description: 'Pick a channel to send the message to.',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listChannels',
},
],
},
},
{
label: 'Message text',
key: 'message',
type: 'string',
required: true,
description: 'The content of your new message.',
variables: true,
},
],
async run($) {
const message = await postMessage($);
return message;
},
});