1

Is it possible for a Mac app to invoke the Messages app to send a message to a particular contact or phone number? The only plausible lead I'm found was the IMService framework, but that seems to be deprecated in 10.9 Mavericks.

Z S
  • 7,039
  • 12
  • 53
  • 105
  • Have you investigated an AppleScript solution? Message might expose some kind of AS interface – cacau Mar 11 '14 at 10:22

1 Answers1

1

One possible approach would be to use Apple Script to send messages via the Messages application.

See this question for an example:
How to send a message using iChat and AppleScript

Community
  • 1
  • 1
cacau
  • 3,606
  • 3
  • 21
  • 42
  • Thanks. The script works by itself, but not when invoked from another app using NSAppleScript. I get a message in the console: "error while executing script. Error { NSAppleScriptErrorAppName = Messages; NSAppleScriptErrorBriefMessage = "A privilege violation occurred."; NSAppleScriptErrorMessage = "Messages got an error: A privilege violation occurred."; NSAppleScriptErrorNumber = "-10004"; NSAppleScriptErrorRange = "NSRange: {110, 41}"; }" – Z S Mar 11 '14 at 23:14
  • Is your app sandboxed? – cacau Mar 12 '14 at 07:03
  • This error is described in detail here: https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_6/RN-10_6.html – cacau Mar 12 '14 at 07:03
  • It is sandboxed. I have followed some instructions on adding the relevant entitlements, but it still doesn't work. In particular, in com.apple.security.scripting-targets, I added: com.apple.iChat com.apple.ichat.applescript – Z S Mar 12 '14 at 18:19