Good question. I already asked this in the context of scanning QR codes that purport to send text messages. And an actual answer emerged here: Librem 5 Capabilities That No Other Phone Has and subsequent replies.
It definitely worked for me. It hasn’t made it into the Wiki yet though. It’s a little untidy but it does work.
Right now if you don’t pause or terminate chatty then it somehow just eats the SMS without sending it. If you were to create a script then chatty would be paused for such a short amount of time that maybe it’s OK.
Before putting those instructions in the Wiki yesterday I did actually type those commands by hand (on the Librem 5 on-screen keyboard, cough, yes, really) and that meant that chatty was paused for several minutes - and even then there were no ill-effects.
However you are of course right. A better long-term solution is an interface into chatty that is compatible with keeping chatty running.
If scripting this then it might be wise to wait until the text message is actually sent before resuming chatty. You can see the status of the message with: mmcli -m any --messaging-list-sms
PS Many different people have contributed to the Tips and Tricks Wiki, not just me.
I have this image of all these dudes hunkering around a mobile phone that is hooked up as a sms server on remote. God that would be great for business marketing sms, especially if one could then actually pickup and hold the sms txt-server in ones hands… and then walk out with it while talking to a client on it.