TaskModules class

TaskModules class to enable fluent style registration of handlers related to Task Modules.

Constructors

TaskModules<TState>(Application<TState>)

Creates a new instance of the TaskModules class.

Methods

configFetch<TData>((context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>)

Registers a handler for fetching Teams config data for Auth or Task Modules

configSubmit<TData>((context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>)

Registers a handler for submitting Teams config data for Auth or Task Modules

fetch<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | TaskModuleTaskInfo>)

Registers a handler to process the initial fetch of the task module.

submit<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<undefined | null | string | TaskModuleTaskInfo>)

Registers a handler to process the submission of a task module.

Constructor Details

TaskModules<TState>(Application<TState>)

Creates a new instance of the TaskModules class.

new TaskModules(app: Application<TState>)

Parameters

app

Application<TState>

Top level application class to register handlers with.

Method Details

configFetch<TData>((context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>)

Registers a handler for fetching Teams config data for Auth or Task Modules

function configFetch<TData>(handler: (context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>): Application<TState>

Parameters

handler

(context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>

Function to call when the handler is triggered.

Returns

Application<TState>

The application for chaining purposes.

configSubmit<TData>((context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>)

Registers a handler for submitting Teams config data for Auth or Task Modules

function configSubmit<TData>(handler: (context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>): Application<TState>

Parameters

handler

(context: TurnContext, state: TState, data: TData) => Promise<BotConfigAuth | TaskModuleResponse>

Function to call when the handler is triggered.

Returns

Application<TState>

The application for chaining purposes.

fetch<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<string | TaskModuleTaskInfo>)

Registers a handler to process the initial fetch of the task module.

function fetch<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<string | TaskModuleTaskInfo>): Application<TState>

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

Name of the verb(s) to register the handler for.

handler

(context: TurnContext, state: TState, data: TData) => Promise<string | TaskModuleTaskInfo>

Function to call when the handler is triggered.

Returns

Application<TState>

The application for chaining purposes.

Remarks

Handlers should respond with either an initial TaskInfo object or a string containing a message to display to the user.

submit<TData>(string | RegExp | Selector | (string | RegExp | Selector)[], (context: TurnContext, state: TState, data: TData) => Promise<undefined | null | string | TaskModuleTaskInfo>)

Registers a handler to process the submission of a task module.

function submit<TData>(verb: string | RegExp | Selector | (string | RegExp | Selector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<undefined | null | string | TaskModuleTaskInfo>): Application<TState>

Parameters

verb

string | RegExp | Selector | (string | RegExp | Selector)[]

Name of the verb(s) to register the handler for.

handler

(context: TurnContext, state: TState, data: TData) => Promise<undefined | null | string | TaskModuleTaskInfo>

Function to call when the handler is triggered.

Returns

Application<TState>

The application for chaining purposes.

Remarks

Handlers should respond with another TaskInfo object, message string, or null to indicate the task is completed.