A BotpressEvent is how conversational channels interact with Botpress. Events represent all the interactions that make up a conversation. That means the different message types (text, image, buttons, carousels etc) but also the navigational events (chat open, user typing) and contextual events (user returned home, order delivered).
The Middleware Definition is used by the event engine to register a middleware in the chain. The order in which they are executed is important, since some may require previous processing, while others can swallow the events. Incoming chain is executed when the bot receives an event. Outgoing chain is executed when an event is sent to a user
Indicates if this middleware should act on incoming or outgoing events
A method with two parameters (event and a callback) used to handle the event
The internal name used to identify the middleware in configuration files
The position in which this middleware should intercept messages in the middleware chain.
The actual middleware function that gets executed. It receives an event and expects to call next()
Not calling next() will result in a middleware timeout and will stop processing
If you intentionally want to stop processing, call
Call next with an error as first argument to throw an error Call next with true as second argument to swallow the event (i.e. stop the processing chain) Call next with no parameters or false as second argument to continue processing to next middleware
Generated using TypeDoc