How to start new conversation in iMessage using AppleScript?

There are many ways to do it.

First example:

on run {targetBuddyPhone, targetMessage}
    tell application "Messages"
        set targetService to 1st service whose service type = iMessage
        set targetBuddy to buddy targetBuddyPhone of targetService
        send targetMessage to targetBuddy
    end tell
end run

Second example:

tell application "Messages"
    set targetBuddy to "+18001234567"
    set targetService to id of 1st service whose service type = iMessage
    repeat
        set textMessage to "Hello pal!"
        set theBuddy to buddy targetBuddy of service id targetService
        send textMessage to theBuddy
        delay (random number from 10 to 30)
    end repeat
end tell

My solution is to tell Applescript to press "Command + N", which is the shortkey for "Start a new conversation"

activate application "Messages"
   tell application "System Events" to tell process "Messages"
   key code 45 using command down           -- press Command + N to start a new window
   keystroke "<replace with phone number>"  -- input the phone number
   key code 36                              -- press Enter to focus on the message area 
   keystroke "<replace with message>"       -- type some message
   key code 36                              -- press Enter to send
end tell

This script will start a new conversation and send the message to the phone number through iMessage