This script (which is a modification of this answer)
send_text = function(number, message){
system(paste('osascript -e \'tell application "Messages"\' -e \'send "', message,
'" to buddy \"', number, '\" of (service 1 whose service type is iMessage)\' -e \'end tell\''))
}
send_text("xxx-yyy-zzzz", "Some message")
Works as expected when sending a text from an Apple environment to another Apple environment. But fails when sending to a Windows-based environment. It leaves the message in the Messages app with a Not Delivered
error message. If you click it you have the option to send as a text message which does work. I don't know anything about AppleScript so I asked chatGPT to come up with a version that sends only text messages.
Its modification was to add "with text" after iMessage) with text
which didn't work. Still had to click send as text message in the Messages app. What did chatGPT get wrong?