This enables third party applications to filter incoming messages and sort them into a separate SMS Junk tab that appears in the Messages app when you use an app that lets you filter messages just like the new version of Truecaller And ii is COurtesy of New iOS 11 Operating System. Truecaller is now tapping into this new functionality in iOS 11 to enable this feature.
Moreover in my point of view i guess These type of apps can use keyword detection or machine learning algorithms to figure out if the messages you are receiving contained spam or useful and then sort them accordingly. If You Using Truecaller on your iOS device, kindly go to your app store and update the app.
Once you update the app, it will guide you on how to enable it.
Just go to Settings > Messages > Unknown & Spam > turn on Truecaller. I’m not quite sure if Truecaller uses simply keyword filtering or machine learning to determine if an incoming message contains spam or not.
Hope This Piece Of Information Helps?