What is the best way to auto assign a group to a user?

Hi,

I would like users that just filled a registration form to be assigned automatically to different groups. In a perfect world it would look like this :

async sendRegistrationMail( mailAdress, assignedGroup )

User would fill the form and have a group assigned right away.

I looked at various topics on that forum and I found solutions such as using an SPI + event listener, coded in java. That looks like a lot of work for such a feature.

Said topics were discussed years ago. Do we have new, simpler ways to do that ?

Any advice is welcome!