# Rasa: Create Custom Channel To Train Data via API

**URL:** <https://forum.rasa.com/t/rasa-create-custom-channel-to-train-data-via-api/41228>\
**Category:** Rasa Open Source\
**Created:** [March 13, 2021, 12:24pm UTC](https://forum.rasa.com/t/rasa-create-custom-channel-to-train-data-via-api/41228 "2021-03-13T12:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baphuc1998](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/baphuc1998/32/13560_2.png) [@baphuc1998](https://forum.rasa.com/u/baphuc1998)\
**Post date:** [March 13, 2021, 12:24pm UTC](https://forum.rasa.com/t/rasa-create-custom-channel-to-train-data-via-api/41228/1 "2021-03-13T12:24:50Z")

</div>

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:

```python
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_{}".format(type(self). __name__ ),
            inspect.getmodule(self). __name__ ,
        )

        @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.

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [March 22, 2021, 4:50pm UTC](https://forum.rasa.com/t/rasa-create-custom-channel-to-train-data-via-api/41228/2 "2021-03-22T16:50:21Z")

</div>

Is this what you’re looking for? [Train model via API](https://rasa.com/docs/rasa/pages/http-api#operation/trainModel)

---

<div class="post-metadata">

**Author:** ![baphuc1998](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/baphuc1998/32/13560_2.png) [@baphuc1998](https://forum.rasa.com/u/baphuc1998)\
**Post date:** [March 23, 2021, 7:36am UTC](https://forum.rasa.com/t/rasa-create-custom-channel-to-train-data-via-api/41228/3 "2021-03-23T07:36:00Z")

</div>

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 ^^
