botbuilder-calling package

Classes

AnswerAction

Action builder class designed to simplify building answer actions.

CallConnector

Connect a UniversalCallBot to the Skype calling service.

CallSession

Manages the bots conversation with a user.

Dialog

Base class for all dialogs. Dialogs are the core component of the BotBuilder framework. Bots use Dialogs to manage arbitrarily complex conversations with a user.

DialogAction

Dialog actions offer shortcuts to implementing common actions.

HangupAction

Action builder class designed to simplify building hangup actions.

Library

A library of related dialogs used for routing purposes. Libraries can be chained together to enable the development of complex bots. The UniversalCallBot class is itself a Library that forms the root of this chain. Libraries of reusable parts can be developed by creating a new Library instance and adding dialogs just as you would to a bot. Your library should have a unique name that corresponds to either your libraries website or NPM module name. Bots can then reuse your library by simply adding your parts Library instance to their bot using UniversalCallBot.library(). If your library itself depends on other libraries you should add them to your library as a dependency using Library.library(). You can easily manage multiple versions of your library by adding a version number to your library name.

To invoke dialogs within your library bots will need to call session.beginDialog() with a fully qualified dialog id in the form of ':'. You'll typically hide this from the devloper by exposing a function from their module that starts the dialog for them. So calling something like myLib.someDialog(session, { arg: '' }); would end up calling session.beginDialog('myLib:someDialog', args); under the covers.

Its worth noting that dialogs are always invoked within the current dialog so once your within a dialog from your library you don't need to prefix every beginDialog() call your with your libraries name. Its only when crossing from one library context to another that you need to include the library name prefix.

MemoryBotStorage

Default in memory storage implementation for storing user & session state data.

PlayPromptAction

Action builder class designed to simplify building playPrompt actions.

Prompt

Prompt builder class that simplifies building prompts for playPrompt action.

Prompts

Built in built-in prompts that can be called from any dialog.

RecognizeAction

Action builder class designed to simplify building recognize actions.

RecordAction

Action builder class designed to simplify building record actions.

RejectAction

Action builder class designed to simplify building reject actions.

SimpleDialog

Allows for the creation of custom dialogs that are based on a simple closure. This is useful for cases where you want a dynamic conversation flow or you have a situation that just doesn’t map very well to using a waterfall. The things to keep in mind:

  • Your dialogs closure is can get called in two different contexts that you potentially need to test for. It will get called as expected when the user send your dialog a message but if you call another prompt or dialog from your closure it will get called a second time with the results from the prompt/dialog. You can typically test for this second case by checking for the existant of an args.resumed property. It's important to avoid getting yourself into an infinite loop which can be easy to do.
  • Unlike a waterfall your dialog will not automatically end. It will remain the active dialog until you call session.endDialog().
UniversalCallBot

Manages your bots conversations with users across multiple channels.

Interfaces

IAction

Base class for all actions.

IActionOutcome

Base class for all action outcome.

IAddress

Address routing information for a message. Addresses are bidirectional meaning they can be used to address both incoming and outgoing messages. They're also connector specific meaning that connectors are free to add their own fields.

IAnswerAction

Answer action allows a bot to accept a Skype call. Answer action should be a first action in response to Conversation notification.

IAnswerOutcome

Result of Answer action.

IBotStorage

Replacable storage system used by UniversalCallBot.

IBotStorageContext

Context object passed to IBotStorage calls.

IBotStorageData

Data values persisted to IBotStorage.

ICallConnector

Implemented by connector plugins for the UniversalCallBot.

ICallConnectorAddress

Chat connector specific address.

ICallConnectorSettings

Options used to initialize a ChatConnector instance.

ICallSessionMiddleware

Function signature for a piece of middleware that hooks the 'botbuilder' event.

ICallSessionOptions

Options passed to the constructor of a session.

IChoiceOutcome

Returned when a choice recognition is selected.

ICollectDigits

Specifies the options for digit collection. For example, "Enter your 5-digit zip code followed by the pound sign."

ICollectDigitsOutcome

Returned when digit collection is selected.

IConfirmPromptOptions

Options passed to a 'confirm' prompt.

IConversation

IConversation is a JSON body of a first request for new Skype voice call made by Skype Bot Platform for Calling to a bot. IConversation JSON body is posted on initial HTTPs endpoint registered by a bot developer in the Bot Framework Portal. IConversation request contains information about caller and target of the call and some additional information about initial state of a call.

IConversationResult

IConversationResult is a JSON body of any subsequent request following the initial IConversation notification that is send to a bot from Skype Bot Platform for Calling. IConversationResult is posted to a callback link provided by previous Workflow response. IConversationResult represents the result of a last successful action from previous Workflow response.

IDialogResult

Results returned by a child dialog to its parent via a call to session.endDialog().

IDialogState

An entry on the sessions dialog stack.

IDialogWaterfallStep

Signature for functions passed as steps to DialogAction.waterfall(). Waterfalls let you prompt a user for information using a sequence of questions. Each step of the waterfall can either execute one of the built-in Prompts, start a new dialog by calling session.beginDialog(), advance to the next step of the waterfall manually using skip(), or terminate the waterfall.

When either a dialog or built-in prompt is called from a waterfall step, the results from that dialog or prompt will be passed via the results parameter to the next step of the waterfall. Users can say things like "nevermind" to cancel the built-in prompts so you should guard against that by at least checking for results.response before proceeding. A more detailed explination of why the waterfall is being continued can be determined by looking at the code returned for results.resumed.

You can manually advance to the next step of the waterfall using the skip() function passed in. Calling skip({ response: "some text" }) with an IDialogResult lets you more accurately mimic the results from a built-in prompt and can simplify your overall waterfall logic.

You can terminate a waterfall early by either falling through every step of the waterfall using calls to skip() or simply not starting another prompt or dialog.

note: Waterfalls have a hidden last step which will automatically end the current dialog if if you call a prompt or dialog from the last step. This is useful where you have a deep stack of dialogs and want a call to session.endDialog() from the last child on the stack to end the entire stack. The close of the last child will trigger all of its parents to move to this hidden step which will cascade the close all the way up the stack. This is typically a desired behaviour but if you want to avoid it or stop it somewhere in the middle you'll need to add a step to the end of your waterfall that either does nothing or calls something liek session.send() which isn't going to advance the waterfall forward.

IDigitsPromptOptions

Options passed to a 'digits' prompt.

IErrorEvent

Function signature for an error event handler.

IEvent

An event recieved from or being sent to a source.

IEventMiddleware

Function signature for a piece of middleware that hooks the 'recieve' or 'send' events.

IFindMatchResult

result returnd from a call to EntityRecognizer.findBestMatch() or EntityRecognizer.findAllMatches().

IHangupAction

Hang up allows for bot to end ongoing call. Hang up is the last action in workflow. Note, the different between Hangup and Reject. Reject action allows the bot to end the call instead of answering the call while Hangup terminates ongoing call.

IHangupOutcome

Returns the result of hangup.

IIdentity

Represents a user, bot, or conversation.

IIsAction

Implemented by classes that can be converted to actions.

IIsEvent

Implemented by classes that can be converted into an event.

IIsPrompt

Implemented by classes that can be converted to prompts.

ILocalizer

Plugin for localizing messages sent to the user by a bot.

IMiddlewareMap

Map of middleware hooks that can be registered in a call to UniversalCallBot.use().

IPlayPromptAction

PlayPrompt allows to play either Text-To-Speech audio or a media file.

IPlayPromptOutcome

Play prompt outcome returns the result of playing a prompt.

IPrompt

Prompt played as part of the PlayPrompt action.

IPromptActionResult

Strongly typed Action Prompt Result.

IPromptChoiceResult

Strongly typed Choice Prompt Result.

IPromptConfirmResult

Strongly typed Confirm Prompt Result.

IPromptDigitsResult

Strongly typed Digits Prompt Result.

IPromptOptions

Options passed to built-in prompts.

IPromptRecordResult

Strongly typed Record Prompt Result.

IPromptResult

Dialog result returned by a system prompt.

IPromptsSettings

Global configuration options for the Prompts dialog.

IRecognitionChoice

Specifies the speech & DTMF options for a choice based recognition. For example, "Say 'Sales' or press 1 for the sales department."

IRecognizeAction

Recognize action allows to either capture the speech recognition output or collect digits from Skype user dial pad.

IRecognizeOutcome

Recognize outcome is a result of recognize action. It contains either recognized digits or recognized speech.

IRecognizerPromptOptions

Options passed to recognizer based prompts.

IRecordAction

Record action is interactive action where Skype user audio is recorded.

IRecordOutcome

Record outcome returns the result of record audio action. RecordOutcome could be returned as multipart content where first part of multipart contain contains the result of action while second part contains binary stream representing recorded audio. The audo stream will be available via the IConversationResult.recordedAudio property.

IRecordPromptOptions

Options passed to a 'record' prompt.

IRecording

Recording returned from the built-in record prompt.

IRejectAction

Reject allows to decline to answer the call. Reject action could be used as first action of first workflow instead of Answer.

IRejectOutcome

Result of Reject action. Reject can be used instead of Answer action if bot decides that the bot does not want to answer the call.

ISessionState

Persisted session state used to track a conversations dialog stack.

IUniversalCallBotSettings

Options used to initialize a UniversalCallBot instance.

IWorkflow

IWorkflow is a JSON body send by the bot in response to IConversation or IConversationResult request from Skype Bot Platform for Calling. IWorkflow contains list of one or more actions that bots instructs Skype Bot Platform for Calling on execute on its behalf as well as callback HTTPs address if bot wants to be notified about result of last executed action outcome.

Enums

PromptType

Type of prompt invoked.

ResumeReason

Reason codes for why a dialog was resumed.