Custom Modules ⚡ supercharges ⚡ your Botpress chatbot building experience by adding in-chat capabilities and by customizing the chatbot editor to your liking.
This Github template is meant as the starting point for building Botpress Custom Modules. You can find a non-exhaustive use-case list here as well as lots of references below.
- Click "Use this template" at the top of the Github repo or fork this repo.
- Make your changes in the code. See How do I do XYZ?
- To rename the package, change the folder name, the name field in src/backend/index.ts and the name field in src/backend/index.ts
- Build using
npm run dockerBuild
. The build will be named "YOUR_PACKAGE_NAME.tgz" and be located in the root folder. - Open Botpress.
- Go to the modules page.
- Click Upload Modules. Select and submit the tgz file.
- Click "Restart Server Now"
- In the modules page, click unpack now next to your module's name.
- Go back up to the list of Stable modules, and activate it by clicking the toggle next to the module's name.
- Start editing a chatbot. notice the flag icon for the custom module.
- When you change your code, restart from from step 7.
Botpress doesn't currently support hot reload for custom module development. If you want to make changes and check them often, we recommend you clone the main repo and follow the instructions found here. Changes will be reflected upon restarting the botpress server.
Generally speaking :
- Clone the main repo.
git clone https://github.com/botpress/botpress.git
- run
yarn && yarn build
in the main repo path. - follow "Module Templates"
- Follow "Local Development Tips"
- Use the command
yarn start
to start the Botpress server. - To see changes, cancel the previous command, and use it again to restart the Botpress server and refresh your browser.
Here is a non-exhaustive list of things you can do with custom modules.
- To add Hooks / middleware : read this
- To add reusible code / actions : read this
- To add new skills to the flow editor like a datepicker : inject them here - docs here
- To create bot templates for creating new bots : add them here - docs here
- To create content types to be sent to your users : add them here
- To create a navigation page within botpress : add them here
Pro tip : The bot making experience is smoother than the custom module building experience. If you can, make your changes in a Botpress Bot, then migrate the changes to your custom module code.