UNPKG

reshuffle-slack-connector

Version:
48 lines (47 loc) 2.01 kB
import { Reshuffle, BaseConnector, EventConfiguration } from 'reshuffle-base-connector'; import SlackMessage from './SlackMessage'; import { ChatScheduleMessageArguments, ChatUpdateArguments, WebAPICallResult, WebClient } from '@slack/web-api'; import { App } from '@slack/bolt'; import { SlackEvents } from './SlackEvents'; export declare enum SlackEventType { MESSAGE = "message", COMMAND = "command", EVENT = "event", ACTION = "action" } export interface SlackConnectorConfigOptions { token: string; signingSecret: string; port?: number; endpoints?: string | { [endpointType: string]: string; }; } export interface SlackConnectorEventOptions { type: SlackEventType; values: { [key: string]: string; }; } export default class SlackConnector extends BaseConnector<SlackConnectorConfigOptions, SlackConnectorEventOptions> { private readonly receiver; private readonly slackApp; private readonly webClient; constructor(app: Reshuffle, options: SlackConnectorConfigOptions, id?: string); onStart(): void; onStop(): void; setupEventEmitters(): void; on(options: SlackConnectorEventOptions, handler: any, eventId: string): EventConfiguration; postMessage(channel: string, message: string | SlackMessage | Array<SlackMessage | string> | ((msg: SlackMessage) => string | undefined)): Promise<WebAPICallResult | void>; updateMessage(channelId: string, text: string, timestamp: string, msgOptions?: ChatUpdateArguments): Promise<WebAPICallResult>; deleteMessage(channelId: string, timestamp: string): Promise<WebAPICallResult>; scheduleMessage(channel: string, postAt: Date, text: string, msgOptions?: ChatScheduleMessageArguments): Promise<WebAPICallResult>; searchMessages(query: string): Promise<WebAPICallResult>; getWebClient(): WebClient; getSlackApp(): App; sdk(): { slackApp: App; webClient: WebClient; }; } export { SlackConnector, SlackMessage, SlackEvents };