# Custom actions
# Development
Botfront makes coding and using Rasa custom actions very easy.
In your project you should have the following folders:
Folder | Description |
---|---|
.botfront | Project configuration files, docker-compose files |
actions | Custom actions for the actions server |
botfront-db | MongoDB persisted files |
models | Persisted models |
rasa | Rasa image material |
You probably figured it out: actions
is our folder of interest.
# Launch the watcher
The first thing to do is to launch the watcher. Symply run botfront watch
from the root of your project. Any change in the actions
folder will rebuild and restart the actions server so you can test the actions in Botfront
# Write custom actions
All actions in the actions
folder will be found by the watcher. You can add actions to the default my_actions.py
file or add new files.
Importing modules in your actions
Your imports must include actions
. If you want to import a module in the actions
folder:
import actions.my_module
# Verify that your actions are registered
Run botfront logs
and verify that your actions are correctly imported. You should see something like INFO:rasa_sdk.executor:Registered function for 'action_guests'.
for each action in the folder.
# Add your action to the conversation
From the conversation builder guide, add your action to the conversation.
# Deployment
You can build your action server Docker image with the Dockerfile.production
in the actions
folder of your project.