The middlewares

Functions are triggered during the script interpretation cycle. Let's use the use() method in javascript

const converse = new NewBot()
// ...
converse.use({
    sending(input, output, { user, data }, next) {
        next()
    },
    finished(input, { user, data }) {

    },
    prompt(input, params, { user, data }) {

    },
    nothing(input) {

    }
})
  • sending() is executed as soon as a message is sent by the script.

  • finished() is executed when the scenario is finished

  • prompt() is executed when the user is prompted to enter a message

  • nothing() is executed when nothing is triggered in the script

Last updated