feat: Implement getData query and send a message action for slack
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
f8c7b85682
commit
8512528fcf
21
packages/backend/src/apps/slack/data/list-channels.ts
Normal file
21
packages/backend/src/apps/slack/data/list-channels.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user