Search Text Messages (Messages App) and Delete

I get a ton of daily spam IN MESSAGES (not email). It is from the same spammer. It always has a body copy of "Hello there". However, the sender uses various email addresses (always ending in pqe@icloud.com) / or phone numbers to spam.

How would I set up a macro where it can identify, delete, and report the spam?

How annoying, I hope someone can give you some tips on this. In the meantime, in case you didn't know: it is possible to block messages from everyone who isn't a contact, if you're using MacOS 10.15 or greater.

I get a lot of true messages from those that aren't necessarily in my contacts. (think: one time codes sent by a vendor, etc.)

Yep, I didn't presume you would necessarily want to. :slight_smile:

Apple scragged AppleScript in their Messages app, so it's really hard to work with.

I'm in the same boat. I REALLY want to be able to automatically DELETE text in Messages App based on if the text message contains a specific string. For example: It a text message in the Message App contains the following string:

"health insurance"

I want that text to automatically delete and block.

Like Bruce mentioned above I get a lot of legit messages from unknown senders so that filter is not an option. Can anyone solve this?

I assume for security reasons, Apple has made it basically impossible to read the content of a message via AppleScript. Perhaps there's some other way, but if there is, I'm not aware of it. The best you could do (that I can think of) would be to select all the text in the message and copy it; then Keyboard Maestro could work with it.

But if you're doing all that already, it's probably easier to just delete-and-block the message.

-rob.