Finding the interface to implement
Unfortunately, interfaces aren’t yet listed on our website, so you must find them in the Botpress GitHub repository. To find the interface you want to implement, follow these steps:Open the interfaces directory
Navigate to the
interfaces directory of the botpress/botpress repository.Adding the interface as a dependency
Once you have the interface name and version, you can add it as a dependency to your integration:Add the dependencies section
If there is no
bpDependencies section in your integration’s package.json file, create one:Add the interface as a dependency
In the
bpDependencies section, add the interface name and version as a dependency. For example, with an interface named creatable and version 0.0.1, you would add the following:Install the interface
Now that you have added the interface as a dependency, you can run the
bp add command to install it. This command will:- Download the interface from Botpress.
- Install it in a directory named
bp_modulesin your integration’s root directory.
Adding a helper build script
To keep your integration up to date, we recommend adding a helper build script to your integration:Add the build script
In the
scripts section, add the following script:If the
build script already exists in your package.json file, please replace it.npm run build, it will automatically install the interface and build your integration. This is useful for ensuring that your integration is always up to date with the latest version of the interface.
Adding the interface to your integration definition file
Now that the interface is installed, you must add it your integration definition file in order to implement it.Import the interface
At the top of the file, import the interface. For example, with an interface named
creatable, you would add the following import statement: