Skip to main content
Module

x/slack_bolt/mod.ts>App

TypeScript framework to build Slack apps in a flash with the latest platform features. Deno port of @slack/bolt
Latest
class App
Re-export
import { App } from "https://deno.land/x/slack_bolt@1.0.0/mod.ts";

A Slack App

Constructors

new
App(unnamed 0?: AppOptions)

Properties

private
authorize: Authorize<boolean>

Authorize

private
clientOptions: WebClientOptions
private
clients: { [teamOrEnterpriseId: string]: WebClientPool; }
private
developerMode: boolean
private
errorHandler: ErrorHandler
private
installerOptions: HTTPReceiverOptions["installerOptions"] | OpineReceiverOptions["opineInstallerOptions"]
private
listeners: Middleware<AnyMiddlewareArgs>[][]

Listener middleware chains

private
logger: Logger

Logger

private
logLevel: LogLevel

Log Level

private
middleware: Middleware<AnyMiddlewareArgs>[]

Global middleware chain

private
receiver: Receiver

Receiver - ingests events from the Slack platform

private
socketMode: boolean
client: WebClient

Slack Web API client

Methods

private
handleError(error: Error): Promise<void>

Global error handler. The final destination for all errors (hopefully).

action<Action extends SlackAction = SlackAction>(actionId: string | RegExp, ...listeners: Middleware<SlackActionMiddlewareArgs<Action>>[]): void
action<Action extends SlackAction = SlackAction, Constraints extends ActionConstraints<Action> = ActionConstraints<Action>>(constraints: Constraints, ...listeners: Middleware<SlackActionMiddlewareArgs<Extract<Action, { type: Constraints["type"]; }>>>[]): void
command(commandName: string, ...listeners: Middleware<SlackCommandMiddlewareArgs>[]): void
error(errorHandler: ErrorHandler): void
event<EventType extends string = string>(eventName: EventType, ...listeners: Middleware<SlackEventMiddlewareArgs<EventType>>[]): void
event<EventType extends RegExp = RegExp>(eventName: EventType, ...listeners: Middleware<SlackEventMiddlewareArgs<string>>[]): void
message(...listeners: Middleware<SlackEventMiddlewareArgs<"message">>[]): void
message(pattern: string | RegExp, ...listeners: Middleware<SlackEventMiddlewareArgs<"message">>[]): void
options<Source extends OptionsSource = OptionsSource>(actionId: string | RegExp, ...listeners: Middleware<SlackOptionsMiddlewareArgs<Source>>[]): void
options<Source extends OptionsSource = OptionsSource>(constraints: ActionConstraints, ...listeners: Middleware<SlackOptionsMiddlewareArgs<Source>>[]): void
processEvent(event: ReceiverEvent): Promise<void>

Handles events from the receiver

shortcut<Shortcut extends SlackShortcut = SlackShortcut>(callbackId: string | RegExp, ...listeners: Middleware<SlackShortcutMiddlewareArgs<Shortcut>>[]): void
shortcut<Shortcut extends SlackShortcut = SlackShortcut, Constraints extends ShortcutConstraints<Shortcut> = ShortcutConstraints<Shortcut>>(constraints: Constraints, ...listeners: Middleware<SlackShortcutMiddlewareArgs<Extract<Shortcut, { type: Constraints["type"]; }>>>[]): void
start(...args: Parameters<HTTPReceiver["start"]>): ReturnType<HTTPReceiver["start"]>

Convenience method to call start on the receiver

TODO: should replace HTTPReceiver in type definition with a generic that is constrained to Receiver

step(workflowStep: WorkflowStep): this

Register WorkflowStep middleware

stop(...args: any[]): unknown

Register a new middleware, processed in the order registered.

view<ViewActionType extends SlackViewAction = SlackViewAction>(callbackId: string | RegExp, ...listeners: Middleware<SlackViewMiddlewareArgs<ViewActionType>>[]): void
view<ViewActionType extends SlackViewAction = SlackViewAction>(constraints: ViewConstraints, ...listeners: Middleware<SlackViewMiddlewareArgs<ViewActionType>>[]): void