Let us see how to upgrade Botpress bot to the latest Botpress version.
Follow below steps.
- Export bot from old version in admin page (This would create a bot_<botid>_<timestamp>.tgz file) and import in the new version by providing bot id and the import file.
- Download latest botpress binary from official site.
- Copy existing bot folder from your older workspace to new one
a. botpress-master\out\bp\data\bots to botpress\data\bots - Add bot id to botpress\data\global\workspaces.json
a. Eg: “bots”: [“infaa1”], - Copy your custom module
a. Eg: botpress-master\modules\infa-module to botpress\modules\infa-module - Enable your custom module in C:\Tools\botpress\data\global\botpress.config.json file
{
"location": "MODULES_ROOT/infa-module",
"enabled": true
}
- Copy custom css to botpress\data\assets\modules\channel-web\infa-style.css
- Restart botpress
- Enable this bot as an embedded bot inside your website. Eg: In your index.html add below 2 script tags
<head>
<script src="http://host:port/assets/modules/channel-web/inject.js"></script>
</head>
<script>
window.botpressWebChat.init({
host: 'http://host:port',
botId: 'infaa1',
overrides: {
before_container: [{
module: 'infa-module',
component: 'InfaMessageController'
}]
},
extraStylesheet: 'http://host:port/assets/modules/channel-web/assets/infa-style.css'
})
</script>
Note: Above steps assume you have a custom stylesheet and you need to embed in an existing website.
0 Comments