Botpress

Botpress

Properties:
Name Type Description
dialogEngine DialogEngine

APIs to create and manipulate conversation flows

kvs KVS

Convenient, high-level storage mechanism

contentManager ContentManager

APIs to manage the content programmatically

renderers ContentRenderer

Change the look and feel of the Content Elements (messages) on the different channels

db Database

(Advanced) Access to the internal Botpress Database

users Users

Store and manipulate data about users

dialogEngine.stateManager DialogStateManager

APIs to manipulate conversation states

logger Logger

Logging utility

botfile Botfile

The current botfile of the running bot

Source:

Methods

Creates a short link for a specific API route, making it easier to share, more verbose and elegant. Short links are available as http://bot_url/s/{name}

Source:
Parameters:
Name Type Description
name String

Unique, url-friendly name of the short link

destination String

The original route to redirect to

params Object

Query parameters to pass the route. Will be serialized.

Example
const config = {
  botName: 'Superbot',
  botConvoDescription: "Tell me something!",
  backgroundColor: '#ffffff'
}

// Visiting "http://bot_url/s/chat" will display the webchat in fullscreen
bp.createShortlink('chat', '/lite', {
  m: 'channel-web',
  v: 'fullscreen',
  options: JSON.stringify({ config: config })
})

getRouter(name, conditionsopt)

Creates an HTTP Express Router that is protected by authentication The router routes are available at "http://bot_url/api/:name" Where name is a string starting with botpress-

Source:
Parameters:
Name Type Attributes Description
name String

The name of the router. Must start with botpress-

conditions object <optional>

See examples. Conditionally disables built-in Botpress middlewares.

Example
const securedRouter = bp.getRouter('botpress-custom')
const publicRouter = bp.getRouter('botpress-custom', { auth: false })

// Conditions can also be used like below
const conditions = { 'auth': req => !/\/webhook/i.test(req.originalUrl) }
const conditionalAuthentication = bp.getRouter('botpress-custom', conditions)