I skimmed the post but couldn't find out how one would know what provider to use. I guess you could ask whoever you're texting with but that's not very reliable, not everyone knows, and people change their provider.
This is a good point. With that said, one does not necessarily need to know the provider, it just makes the process more direct. An alternative approach is to send a message to every provider using the same number. The invalid addresses will likely bounce back, but the correct match will go through.
I mentioned this website in the post. It has a list of providers for different countries (Brazil included). I don't know how up-to-date they are, but it might be a good starting point. You can also always try contacting the carriers directly. https://email2sms.info/
Thank you, what I missed is how you do to find out for other providers. In Brazil you covered 50% of the carriers. But how can I help you to find out the other ones and update the information for you. Should I contact the providers and ask for it and send a Pull Request?
Still costs money, but if you're sending a lot of messages, this would substantially reduce the costs.