feat: Create send slack message action
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
fb7e679230
commit
5e1fc510ff
@@ -0,0 +1,21 @@
|
||||
import { WebClient } from '@slack/web-api';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class SendMessageToChannel {
|
||||
client: WebClient;
|
||||
parameters: IJSONObject;
|
||||
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
this.client = new WebClient(connectionData.accessToken as string);
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
async run() {
|
||||
const result = await this.client.chat.postMessage({
|
||||
channel: this.parameters.channel as string,
|
||||
text: this.parameters.message as string,
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user