9

Does anyone know how to send a group message using applescript/osascript? I've tried a bunch of stuff but nothing seems to work.

Cody C
  • 3,087
  • 4
  • 24
  • 32
  • That's a different question. He's sending a message to multiple individual people. I want to send a group message. – Cody C Apr 17 '13 at 16:57
  • 3
    By `group message` do you mean a group that you've defined in your contacts, or where exactly? – l'L'l Mar 26 '15 at 23:20

2 Answers2

2

From iMessages dictionary

If you take a look into the iMessages (former iChat) dictionary you see that you only can send messages to a buddy or a text chat. There is no "group" available. BUT, if you have a group, say a list of people, you can compare this to available buddies and send to each one of them, like suggested in this post.

Community
  • 1
  • 1
turingtested
  • 6,356
  • 7
  • 32
  • 47
1

@turingtested's response above led me to a solution that solved this problem for me, provided that there's an already-existing named chat.

In AppleScript's documentation, send can send to a chat:

AppleScript send documentation

A chat has a name property that is how the chat's name appears in the chat list:

AppleScript chat documentation

I then went into Messages, created the desired group and added a group name.

To add a group name in Messages.app on macOS, right click on the group, select Details…, click on Change Group Name and Photo, and edit the group name as desired.

Once you've done that, the following code will do the trick:

tell application "Messages"
    send "Your message here" to chat "group name"
end tell
Vincent
  • 2,689
  • 3
  • 24
  • 40