> For the complete documentation index, see [llms.txt](https://docs.newbot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.newbot.io/use-newbot-framework-js/the-middlewares.md).

# The middlewares

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

```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
