feat: Implement getData query and send a message action for slack

This commit is contained in:
Faruk AYDIN
2022-03-15 02:57:37 +03:00
committed by Ömer Faruk Aydın
parent f8c7b85682
commit 8512528fcf
14 changed files with 305 additions and 92 deletions

View File

@@ -0,0 +1,21 @@
import type { IJSONObject } from '@automatisch/types';
import { WebClient } from '@slack/web-api';
export default class ListChannels {
client: WebClient;
constructor(connectionData: IJSONObject) {
this.client = new WebClient(connectionData.accessToken as string);
}
async run() {
const { channels } = await this.client.conversations.list();
return channels.map((channel) => {
return {
value: channel.id,
name: channel.name,
};
});
}
}