Sending a iMessage in message application by phone number

How can I send a message in the messages application by phone number?

I’ve tried this,

tell application "Messages"
		set theNumber to buddy "+13109261903"
		send "test" to theNumber
end tell

With error. Messages got an error: Can’t get buddy “+13109261903”.

Hi. A phone number is only a property”handle/handler”not the buddy itself. This is untested, but you could try:


tell application "Messages" to send "test" to  (buddy 1 whose handle is "+ 13109261903")

Thanks, it works now.

I had to take the space out the number,

tell application "Messages" to send "test" to (buddy 1 whose handle is "+13109261903")