How to add message preprocessor to HTTP server

Hi, I have been struggling reading through source code. I really need to add a preprocessor to the HTTP server. I have added that to an agent with the message_preprocessor parameter. I can’t find a natural way to do it for the server. Someone, please help

Hi there, what do you need the preprocessor to do? What exactly did you provide as your message_preprocessor within the agent?

I realized a simple custom channel would solve my problem. I am working on it right now. Seeing that you have replied many post regarding custom channel, can you tell me what should be “mypackage” and what should be “MyIO” in my credential file.

I have created a InputChannel class Normalizer, and the name function returns “Normalizer”. How should i configure my credential file?

Thank you @erohmensing

“MyIO” is the name of the channel, so I believe it should be "Normalizer here. As for mypackage, that’s for the path to the file – the logic of finding the custom InputChannel class happens here. Did you add your new channel to the directory with the other channels in rasa core? if so, I believe that if you add your channel to the input_channel_classes in the init, it will find it without any path prefix (so just normalizer:), like the rest of the channels. Otherwise, i would check out the utils.class_from_module_path(channel) method to figure out how it’s finding the path to figure out what your mypackage prefix should be.

As for what goes in the credentials, it’s perfectly fine not to have any if it’s something you custom-made (the rest channel similarly has no credentials).

Thank you for your reply @erohmensing . I configured my credential.yml like so: normalize_input.Normalizer: with nothing beneath like a rest channel credential.

I run python -m --enable_api -d models/dialogue_models -u major_bot/hengha --endpoints endpoints.yml --credentials credentials.yml -o out.log and the server runs without errors. The GET conversation tracker api etc are working. However, the post("http://localhost:5005/webhooks/rest/webhook",json={"sender":"1","message":"hello"}).json() is not working and says “404 374” error.

Do you know what happened? @erohmensing


your myIO needs to go in the url – perhaps try


Thank you ~~ @erohmensing , it works. I have been struggle for weeks. Life is good again.

1 Like

Yay! I’m so glad it worked! :slight_smile:

Seems like we should be able to add a custom channel without forking rasa itself and modifying

Is there a way to do that?