That caught my attention too. Right now, the cheapest option out there still seems to be getting a dumbphone and a few pre-paid SIM cards. Sadly, pre-paid cards are no longer an option in many EU countries. Even just the least expensive SMS gateways are like 10 €/month last time I checked.
The good news is that if you find a prepaid SIM in one EU country, you should be able to continue using it in every EU country as long as you top it up. I often wish I still had my Croatia SIM card that I bought at a Tisak kiosk for €10.
I'm a happy customer of voip.ms, it costs me less than $1 per month for a US number. Their service has been very stable. They support REST API access and webhooks.
It works roughly 3/4th of the time for me. I've heard that you can increase your chances by buying a 'real' prepaid phone number on eBay for $10 or so, and then porting it over to a VoIP provider.
Not really the same solution but cheap (as low as $3 monthy in EU) to get a number, esim, a free pbx/many integrations and receive sms. You don't even need to put credits.