SMS Workflow using Twilio and Script block

Looking at this issue regarding sending ‘single’ message using scriptiing block which was resolved by @Mike_Pennisi i was wondering if we could also be able to using script block/ Twilio to calculate how much it will cost to send a certain SMS to a number of users? Also a way to get the budget per group or assigned group.
And lastly using script block calculate the total cost and and enable/disable the sending according to the actual budget.
Has anyone worked on something similar ? or found a hack around this…

Twilio’s REST API includes resources for estimating pricing, so this definitely seems possible! I’d start by reviewing Twilio’s API documentation: