Sending Whatsapp message through Automator

I have the Whatsapp MacOS app installed. I am trying to experiment sending a whatsapp message using the Automator Workflow.

What I've tried to do: 1. Create a new workflow/application in automator. 2. Started Record 3. Opened the whatsapp application and sent a message(m) to a person(x) 4. Stopped recording

I believe it got saved under the "Watch me Do" workflow. But when I try to run it, I get a "OS Status error operation status -50". I made sure the accessibility permissions are available for the Automator in Security and Privacy settings.

Can you please let me know where I'm going wrong and what I can do to get over this?


Solution 1:

First you should check if the Whatsapp is also enabled on Privacy Settings. Plus you can try doing that using a Run Applescript action. Something like this:

on run {input, paremeters}
     tell application "Whatsapp"
          activate
     end tell
     tell application "System Events"
          keystroke "Your message here"
     end tell
end run

Assuming you have the right group/person window already selected.