Classes

BotApp

Adapter for Wingbot flight director

Processor

Messaging event processor

Functions

afterProcessMessage(req, res)

Typedefs

Options : object
ApiResponse : object
AutoTypingConfig : object
Plugin : object
TrackingEvent : object
TrackingObject : object
InteractionEvent : object
ProcessorOptions : object
IntentAction : object
 

BotApp

Adapter for Wingbot flight director

Kind: global class

 

new BotApp(bot, options)

Param Type
bot ReducerWrapper \ Router
options Options
 

botApp.processor ⇒ Processor

Get the processor instance

Kind: instance property of BotApp

 

botApp.request(rawBody, rawHeaders) ⇒ Promise.<ApiResponse>

Process incomming API request from the orchestrator.

The response can be sent using an express, or you can directly return the response to

Kind: instance method of BotApp

Param Type
rawBody string \ null
rawHeaders object

Example

const express = require('express');
const { Router, BotApp } = require('express');
const app = express();

const bot = new Router();

bot.use((req, res) => { res.text('hello!'); });

const botApp = new BotApp(bot, {
    apiUrl: 'https://<url to orchestrator>',
    secret: '<application secret in orchestrator>'
});

app.get('/bot', express.text(), (req, res) => {
   botApp.request(req.body, req.headers)
       .then((response) => {
           const { body, statusCode, headers } = response;

           res.status(statusCode)
               .set(headers)
               .send(body);
       })
});
 

BotApp.plugin() ⇒ Plugin

Returns processor plugin, which updates thread context automatically

Kind: static method of BotApp

 

afterProcessMessage(req, res)

Kind: global function

Param Type
req Request
res Responder
 

Options : object

Kind: global typedef
Properties

Name Type
secret string \ Promise.<string>
[apiUrl] string
[fetch] function
[chatLogStorage] ChatLogStorage
 

ApiResponse : object

Kind: global typedef
Properties

Name Type
statusCode number
body string
headers object
 

AutoTypingConfig : object

Kind: global typedef
Properties

Name Type Description
time number duration
perCharacters number number of characters
minTime number minimum writing time
maxTime number maximum writing time
 

Plugin : object

Kind: global typedef
Properties

Name Type
[processMessage] function
[beforeAiPreload] function
[beforeProcessMessage] function
[afterProcessMessage] function
 

TrackingEvent : object

Kind: global typedef
Properties

Name Type
type string
category string
action string
label string
value number
 

TrackingObject : object

Kind: global typedef
Properties

Name Type
events Array.<TrackingEvent>
 

InteractionEvent : object

Kind: global typedef
Properties

Name Type
req Request
actions Array.<string>
lastAction string \ null
state object
data object
skill string \ null
tracking TrackingObject
 

ProcessorOptions : object

Kind: global typedef
Properties

Name Type Description
[appUrl] string url basepath for relative links
[stateStorage] object chatbot state storage
[tokenStorage] object frontend token storage
[translator] function text translate function
[timeout] number chat sesstion lock duration (30000)
[justUpdateTimeout] number simple read and write lock (1000)
[waitForLockedState] number wait when state is locked (12000)
[retriesWhenWaiting] number number of attampts (6)
[nameFromState] function override the name translator
[autoTyping] boolean \ AutoTypingConfig enable or disable automatic typing
[log] function console like error logger
[defaultState] object default chat state
[autoSeen] boolean send seen automatically
[waitsForSender] boolean use 'false' resolve the processing promise without waiting for message sender
[redirectLimit] number maximum number of redirects at single request
[secret] string Secret for calling orchestrator API
[apiUrl] string Url for calling orchestrator API
[fetch] function Fetch function for calling orchestrator API
 

IntentAction : object

Kind: global typedef
Properties

Name Type
action string
intent Intent
sort number
[score] number
local boolean
aboveConfidence boolean
[winner] boolean
meta object
title string
[meta.targetAppId] string
[meta.targetAction] string \ null

results matching ""

    No results matching ""