Jump to content

Send a Message template workflow


Recommended Posts

Inspired by this thread to revisit an old, poorly written workflow of mine, this workflow is designed to send a message (using the Messages app) to a selected contact. I have called it a "template workflow" because you have to do some work in order to make it work.

 

(The workflow has no dependencies other than relying on the Messages app and a little AppleScript.)

The List Filter is populated with some names and numbers (and I apologise if your name is among them—but don't worry, it's not your number). It looks like this:
 

Listfilter.thumb.png.e6429de4175c85a46c5ade6e4af79acb.png

Note the format of the Arg for the name. When you add a name that is the format you should follow: name,number (i.e., separarated only by a comma). All you need to do is to substitute details of your contacts for the names given in the List Filter. Simply follow the format used in the initial list.

Usage

The workflow will prompt you:

  • to choose from your pre-populated list of contacts; and then
  • for the text of a message to send via the Messages app.


It then sends the message and quits the app.

 

Recipient.thumb.png.db0d5b6a4f92a4c4baca5e45079f9478.png

Message.thumb.png.e0fb721740aa8002a5e2bee307d5e6d3.png

GitHub download link

 

Stephen

Link to comment

@sepulchra thanks for the comment—which is entirely justified. Frankly, icons have always been a curse for me: I seem to spend more time trying to find appropriate icons than I do writing the workflows (in spite of the usefulness of https://font2png.com/). I did get the impression that, in a kindly way, @vitor tried to dissuade me from using macOS app icons for workflows—even if those workflows relied on that app. I may, of course, be wrong about that!

 

My own copy of this workflow naturally uses the Messages app icon. 😀

 

I'll cast around and see if I can find some better icon for the GitHub workflow.

 

Stephen

Link to comment

Cool workflow! I'm getting the following error in 10.15 Catalina: script error: Expected end of line, etc. but found identifier. (-2741)

 

Can the workflow send messages to email addresses (i.e. people with Android phones)?

Link to comment
11 minutes ago, dood said:

I'm getting the following error in 10.15 Catalina: script error: Expected end of line, etc. but found identifier. (-2741)

I'm sorry, I'm on Ventura and can't reproduce that error. If you know how to do it one way to find out a little more would be to run the script in Script Editor. Try copying and pasting this into Script Editor:

 

set targetFriend to "+123456789123"
set textMessage to "This is a test message"
tell application "Messages"
	set targetService to (id of 1st account whose service type = iMessage)
	set theFriend to participant targetFriend of account id targetService
	send textMessage to theFriend
end tell

Click on the three lines at the right end of the status bar at the bottom of the Script Editor window—that will split the screen horizontally. Run the script and let me know if there's anything more specific by way of an indication of where the error is. You may have to click between the various window options on the divider bar in Script Editor.

 

20 minutes ago, dood said:

Can the workflow send messages to email addresses (i.e. people with Android phones)?

No—because it's specifically looking for people who are registered with the Apple Messages service.

 

Stephen

Link to comment
2 hours ago, dood said:

I'm getting the following error in 10.15 Catalina: script error: Expected end of line, etc. but found identifier. (-2741)

You could also try replacing the following lines in the Run Script action of the workflow:

set targetService to (id of 1st account whose service type = iMessage)
set theFriend to participant targetFriend of account id targetService

with these lines:

set targetService to 1st service whose service type = iMessage
set theFriend to buddy targetFriend of targetService

 

So far as I can discover there seems to have been a change in the AppleScript programming of Messages between macOS Catalina and macOS Ventura but I am rather working in the dark, I'm afraid!

 

Stephen

Edited by Stephen_C
Removed redundant definite article in text!
Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...