Sending text messages with Panorama

I’ve been using a mass text message service for a while now, it’s been free (with ads). However, they suddenly decided to charge people receiving the texts!

Has anyone integrated Message with PanX or even Pan6 for that matter? I’d like to maintain my opt in text subscribers in a Panorama database and simply enter a message and have it send to everyone individually on my list.

That would be really sweet!

Sending a text is done the same way as sending an email so it’s actually pretty easy right out of Panorama. I use it from my desktop as well as on servers with the Python script as used in Mailbox, available in the Database Exchange. You can send to one at a time or loop through a list of any length.

The address is the ten-digit phone number plus the @carrier. The downside is that you have to know what carrier your recipients are using. Lists are available from sites such as: List Of Email-To-SMS Addresses - AVTECH

Well I do send emails using the following command:
ShellOpenDocument “mailto:”+email

Or I use this in some databases when the text of the message is determined by the data. The variable “TEMP” is established by the procedure and is the email message:
sendoneemail "info@nyautofest.com", email, “SUBJECT OF EMAIL”, TEMP

So it’s not just as easy to send a text that accesses MESSAGES so we don’t need the carrier?

To send text messages via email you do need the carrier.

I understand that James, what I’m wondering is if there is a way to have panorama “preload” a text message into MESSAGES so then the carrier sin’t needed.

No, what Jim is talking about is using the Email channel. It doesn’t involve your normal email client, but rather sending directly to a server.

I’ve never done it, but I believe you can send SMS messages thru a web service like Twillio. It should be possible to write a Panorama program to access their web API. though this would require a bit of programming experience. Using a service like this isn’t going to be free, but I think they can send text messages with just the number, you don’t have to know the carrier.

There are other similar services as well, probably a google search for SMS API would turn up a list.

Right! Via Python, authenticated email can be composed and sent from within Panorama. The whole body of the message can be assembled, merged with data to be unique to every recipient - or not - and sent. Essentially the Panorama database doing the work becomes your email client, custom tailored to fit your specific needs.

Well I’ve done some experimenting and I’ve written a test bed that sends a text message through the Mail app just fine althigh it does require knowing the recipient’s service. I guess I’ll have to live with it if a free service doesn’t come along. RainedOut was free with ads but now they are “upgrading” to charging recipients which is not acceptable.
It’s not the ideal way I want to send text messages but it does work for sending to 100+ recipients.

The Applescript dictionary for Messages looks to be quite rich, so it should be possible to send messages through it. But I am not able to help you with the specifics.

hmmm… thanks Bruce, good idea. I’ll play with it.

This thread contains a functioning example:

the guts of the AppleScript:

set phoneNumber to “xxxxxxxxxx”
set message to “Your text here.”

tell application “Messages”
send message to buddy phoneNumber of service “SMS”
end tell

As the last example on the link demonstrates, this can be put in a wrapper and run from a script file.

However, it is also possible to use the shellscript command with osascript to create a short procedure within Panorama:

local tPhone, tMessage, tCommand, tResult

tPhone = “valid_phone_number”
tMessage = “your_message_here.”

tCommand = |||osascript -e ’
set theMessage to ^«{“} + tMessage + {”}»^
set phoneNumber to ^«{“} + tPhone + {”}»^
tell application “Messages”
send theMessage to buddy phoneNumber of service “SMS”
end tell’|||

shellscript tCommand, tResult

Similarly, the applescript command can be used in a Panorama procedure:

local tPhone, tMessage, tCommand, tResult

tPhone = “valid_phone_number”
tMessage = “your_message_here.”

tCommand = |||
tell application “Messages”
send $«{“} + tMessage + {”}»$ to buddy $«{“} + tPhone + {”}»$ of service “SMS”
end tell
|||

applescript tCommand, tResult

I’ve confirmed that this works on Mojave.

Unfortunately, this no longer seems to work on Sonoma OS 14.5. In Applescript, Messages changes “Buddy” to “Participant” and “service” to “account”, and I get an error message. I looked up my “accounts” and the account with the service type of “SMS” has an id of “2A707004-78D9-46E4-9FDF-34F42DF299DE”. The closest I’ve come to creating a working script is

tell application "Messages"
	send "hi" to participant id "myPhoneNumber" of account id "2A707004-78D9-46E4-9FDF-34F42DF299DE"
end tell

That does not get an error message, but no text seems to get sent. Suggestions?

This code works on Sequoia 15.01:

tell application "Messages"
        -- set iMessageService to (1st account whose service type = iMessage)
        set iMessageService to (1st account whose service type = SMS)
        set iMessageBuddy to participant "18885551212" of iMessageService
        send "Hello!" to iMessageBuddy
 end tell

Both the iMessage and SMS service type work. See the discussion at StackExchange.

1 Like