How do I invite buddies to an iMessage chat using AppleScript

So far I have this code, where the (***)***-**** is a phone number that I have in my contacts. I have a group chat named applescripttest with two other people, and I want to add theBuddy to the chat.


tell application "Messages"

set theBuddy to buddy "(***)***-****" of (service 1 whose service type is iMessage)

invite theBuddy to "applescripttest" with message "test"

end tell


This gives me an error message of the following:

(the asterisks are the phone number, and the #'s are a bunch of characters, and I don't if they reveal personal information)


Messages got an error: buddy id "################:+1**********" doesn’t understand the “invite” message.


By the way, if I were to swap the line where I invite theBuddy for:

send "test" to theBuddy


It sends a message to theBuddy without an error.

Did you ever find an answer to this? I'm looking at this exact problem right now, but can't seem to find a way to create a new buddy.
Found this similar item on Stack Overflow: How to send an imessage text with applescript, only in provided service? while searching for something similar.

It's old, and I haven't tried any of the answers out, yet, but they look like they'd work...
How do I invite buddies to an iMessage chat using AppleScript
 
 
Q