Rasa: Create Custom Channel To Train Data via API

Hello everyone. Now, I have a rasa app and it works really well. However, I want to train more data for my chatbot using API (maybe using a custom channel). Specifically, I will send files like: nlu, story, domain via the API and will replace the old data files . And then call the API to activate the train command again.

I have a custom channel like this:

class MyBOT(InputChannel):
    def name(cls) -> Text:
        """Name of your custom channel."""
        return "mybot"

    def blueprint(
        self, on_new_message: Callable[[UserMessage], Awaitable[None]]
    ) -> Blueprint:

        custom_webhook = Blueprint(

        @custom_webhook.route("/", methods=["GET"])
        async def health(request: Request) -> HTTPResponse:
            return response.json({"status": "ok"})

        @custom_webhook.route("/webhook", methods=["POST"])
        async def receive(request: Request) -> HTTPResponse:
            return response.json(collector.messages)
        return custom_webhook

        @custom_webhook.route("/custom/train", methods=["POST"])
        async def health(request: Request) -> HTTPResponse:
            # This is where I want to receive training data files from client side and replace existing data files.
            return response.json({"status": "ok"})

But rasa doesn’t seem to be aware of my API /custom/train.

Does someone have any ideas?

Or is there another way to make the API call to trigger the rasa command? Please help me.

Is this what you’re looking for? Train model via API

The train model API uses a string format by default. It was very difficult for me to convert it from Markdown format to string. I have a lot of trouble converting it so I’m hoping to find an easier way ^^