Oh man, you're absolutely right - you said message, and I read 'email message'. My bad.
Messages is actually much easier. Try:
property myReplies : {"Hi", "thanks for calling", "Have a nice day :)", "I'll get back to you"}
using terms from application "Messages"
on message receivedtheMessagefromtheBuddyfortheChat
-- chage this line to match the name of the person you want to trigger on
if name of theBuddy = "Joe Smith" then
set msgReply to some item of myReplies
sendmsgReplytotheBuddy
end if
end message received
# The following are unused but need to be defined to avoid an error
on received text invitationtheTextfromtheBuddyfortheChat
end received text invitation
on received audio invitationtheTextfromtheBuddyfortheChat
end received audio invitation
on received video invitationtheTextfromtheBuddyfortheChat
end received video invitation
on received file transfer invitationtheFileTransfer
end received file transfer invitation
on buddy authorization requestedtheRequest
end buddy authorization requested
on message senttheMessagefortheChat
end message sent
on chat room message receivedtheMessagefromtheBuddyfortheChat
end chat room message received
on active chat message receivedtheMessage
end active chat message received
on addressed chat room message receivedtheMessagefromtheBuddyfortheChat
end addressed chat room message received
on addressed message receivedtheMessagefromtheBuddyfortheChat
end addressed message received
on av chat started
end av chat started
on av chat ended
end av chat ended
on login finishedfortheService
end login finished
on logout finishedfortheService
end logout finished
on buddy became availabletheBuddy
end buddy became available
on buddy became unavailabletheBuddy
end buddy became unavailable
on completed file transfer
end completed file transfer
end using terms from
Save it as a compiled script in ~/Library/Application Scripts/com.apple.iChat, then it should be available under the 'AppleScript handler' option in Messages preferences.