3

I've been doing some searching around online for an answer to this question and can't seem to find one. My aim is to run a bash script which waits for the arrival of an iMessage from a specific contact and when the message is received, it inputs the content of the iMessage into a specified command.

I understand that whatever the command is (if there is one) to check for the presence of a new message from a specified contact will probably have to be repeated in some sort of loop but for now, I am just wondering if there is some sort of command (maybe osascript) which can check for this?

E.g.

iMessage: From, Tom: Hello World

echo "$imessagemessage" > ~/Desktop/message.txt

Does anyone know if this is possible? If so, I would really appreciate it if someone could give me some guidance.

Thank you in advance,

Kind regards,

Tom

  • Your going to have to check the database with SQL Lite prob – JBis Jul 18 '18 at 18:23
  • @JBis Thanks for your reply, was considering that but thought it would be rather inefficient. Any suggestions on how to best integrate this with a Bash script? – Tom Jul 18 '18 at 18:25
  • Read this github.com/ZekeSnider/Jared/issues/20 – JBis Jul 18 '18 at 18:53
  • @JBis Just had a read through and tried the AppleScript that "mezeipetister" suggested but can't seem to get that working due to Syntax Errors. Any advice? I've also read this guide: hackernoon.com/a-crude-imessage-api-efed29598e61 but it seems that this is now obsolete due to it being designed for older operating systems. – Tom Jul 18 '18 at 19:04
  • if you are interested, i can share a python script that is reading from Messages.app database with content and extract however you want to or send messages with it. – ggnoredo Jan 8 at 13:04

You must log in to answer this question.

Browse other questions tagged .