UniversalCallBot class

Manages your bots conversations with users across multiple channels.

Constructors

UniversalCallBot(ICallConnector, IUniversalCallBotSettings)

Creates a new instance of the UniversalCallBot.

Methods

dialog(string, Dialog | IDialogWaterfallStep[] | IDialogWaterfallStep)

Registers or returns a dialog for the bot.

get(string)

Returns the current value of a setting.

library(Library | string)

Registers or returns a library dependency.

on(string, Function)

Registers an event listener.

set(string, any)

Sets a setting on the bot.

use(IMiddlewareMap[])

Installs middleware for the bot. Middleware lets you intercept incoming and outgoing events/messages.

Constructor Details

UniversalCallBot(ICallConnector, IUniversalCallBotSettings)

Creates a new instance of the UniversalCallBot.

new UniversalCallBot(connector: ICallConnector, settings?: IUniversalCallBotSettings)

Parameters

connector
ICallConnector

(Optional) the default connector to use for requests. If there's not a more specific connector registered for a channel then this connector will be used./**

settings
IUniversalCallBotSettings

(Optional) settings to configure the bot with.

Method Details

dialog(string, Dialog | IDialogWaterfallStep[] | IDialogWaterfallStep)

Registers or returns a dialog for the bot.

function dialog(id: string, dialog?: Dialog | IDialogWaterfallStep[] | IDialogWaterfallStep)

Parameters

id

string

Unique ID of the dialog being regsitered or retrieved.

dialog

Dialog | IDialogWaterfallStep[] | IDialogWaterfallStep

(Optional) dialog or waterfall to register.

  • dialog: {Dialog} - Dialog to add.
  • dialog: {IDialogWaterfallStep[]} - Waterfall of steps to execute. See IDialogWaterfallStep for details.
  • dialog: {IDialogWaterfallStep} - Single step waterfall. Calling a built-in prompt or starting a new dialog will result in the current dialog ending upon completion of the child prompt/dialog.

Returns

get(string)

Returns the current value of a setting.

function get(name: string)

Parameters

name

string

Name of the property to return. Valid names are properties on IUniversalCallBotSettings.

Returns

any

library(Library | string)

Registers or returns a library dependency.

function library(lib: Library | string)

Parameters

lib

Library | string

  • lib: {Library} - Library to register as a dependency.
  • lib: {string} - Unique name of the library to lookup. All dependencies will be searched as well.

Returns

on(string, Function)

Registers an event listener.

function on(event: string, listener: Function)

Parameters

event

string

Name of the event. Event types:

listener

Function

Function to invoke.

set(string, any)

Sets a setting on the bot.

function set(name: string, value: any)

Parameters

name

string

Name of the property to set. Valid names are properties on IUniversalCallBotSettings.

value

any

The value to assign to the setting.

Returns

use(IMiddlewareMap[])

Installs middleware for the bot. Middleware lets you intercept incoming and outgoing events/messages.

function use(args: IMiddlewareMap[])

Parameters

args

IMiddlewareMap[]

One or more sets of middleware hooks to install.

Returns