Detecting oversized message in NLU component

Hi, currently using Rasa 2.4.3.

I’m trying to build a custom component that detects too long message (we have a size limit in the UI, but still one could send messages to the bot directly), deletes the message and sets a specific intent, so that we can react to this later. However, I can’t find a way to manipulate the incomming message. I read some guides about spell corrector components, which basically try the same thing, but they seem to be outdated. So, how do I change the message text in a component so that every component later sees the altered message and not the original?

Technically, you could write a custom component that removes text from the incoming message before it is passed on to the tokenizer. This, mainly technical, would work for Rasa Open Source 2.x but it would be a giant hack that won’t work in Rasa Open Source 3.0 going forward.

I wonder. If there is a size limit in the UI, doesn’t that already prevent very long messages from getting to the bot?

We fixed the issue now, with a custom connector, that prevents oversized messages from reaching the bot.

Sure the UI may be limited, but it is always possible to circumvent the UI using a script and sending oversized messages to the bot directly.