Send iMessage or SMS Message

I searched the macro library and could not find any example of macros that send out iMessages or SMS messages.

I would appreciate anyone sharing their macro with me as I would like to set macros to automatically respond to incoming messages as well as macros to send out some standard messages with a few keystrokes.


Sending out an SMS using KM is very easy. Something like this:

Of course you can use variables in either field.

The last time I looked into receiving SMS messages into KM, that was extremely difficult and I gave up. But I'm willing to try again. Maybe things have changed. Back when I first tried it, Apple didn't allow apps to hook into incoming SMS. However the SMS messages are stored in the Apple file system, but it was extremely hard trying to decode them.

Are you willing to have a KM macro "receive" the SMS messages by using the mouse to click on the Messages App and then read the messages using OCR and then parse them that way? This is another way, entirely possible, but very tricky.

@Sleepy, I dont know how I ever missed that! Thank you for pointing it out to me.

If it is reliable and automated then sure why not?

I don't think anyone has ever done it yet, so I don't know if it's reliable. Since it hasn't been done, it hasn't been automated yet.

At this point I'm not offering to write it (all) for you. But I am offering to set you in the right direction by telling you the techniques you need to use. I think Monterey OCR is going to work quite well for this task.

The main idea is to open the Messages window using KM, make sure you have clicked on the correct user/group in the left pane, and use Monterey OCR to read all the lines of text in the right pane. Detecting if something "new" has arrived could be done by comparing the current OCR to the previous OCR. If there's new text at the bottom, you have received a message. -- Do you see how insane this method is? I think it would work, but it would take some good finessing.

Appreciate the offer and do see it as a lot of work.

I think I will explore my still developing AppleScript skills first as it may be easier at that level. The problem that I have is that I will need to wait a few weeks as Apple has crippled the AS capabilities of iMessages in Catalina (which is the OS I am stuck on because of the vintage of my MacBook); specifically, the Participant property of iMessages' Chat class cannot even be read on Catalina but I am told it can be on Monterey. Without this capability I have no way of identifying who is sending the iMessage!

I will wait and see for myself.


That's big news if Monterey has the ability to (allow apps to) read iMessages. I don't think this was possible in macOS five years ago. I would be thrilled to exploit this.

About 5 or 6 years ago I started playing with AppleScript but it only lasted a few months as life got in the way. I learnt a bit but not much in a very trial and error way.

I wrote, at the time, a macro to clean out my iMessages and delete specific ones based on certain criteria, one of which was who sent it.

One or two months ago I decide to get into it but in a much more formal and structured way. When I tried to run that very same As it crashed, I could not figure out why.

With that, I decided to get a copy of Script Debugger which is a much more robust AS platform that Apple Script itself which revealed that teh Participant property was no longer available.

When I asked one or two people in the MacScripter forum for help they shared with me that it was available on, it was available when I wrote the script in 2015 (on whatever macOS version of OS X was current at the time), is not available on Catalina and is again available on Monterey, very weird.

PS. A big thank you to Script Debugger for taking me out of my misery (and no, I have no affiliation with Late Night Software, its author)!

Apple has gutted Messages AppleScript dictionary.

Many things that were possible in macOS Sierra are no longer possible.


Exactly what I have discovered though Apple Debugger (I cannot tell you how many hours I wasted trying to get what once worked to work again without knowing that Apple had taken away its functionality) and through others with Montery.

I am looking forward to seeing whether that functionality has actually been restored on Monterey.

Very curious as to why Apple would kill the functionally post Monterey.


Apple's commitment to making their own apps scriptable and fixing ongoing bugs is very spotty.

Complain! Not enough people do...

Feedback - macOS - Apple

1 Like

On it!