I am working on impliment an alert system with google talk. Basically when an event happens on the server, I want a message to go out via Google Talk to a predefined person. I found the guide by Ben Forta on building an IM bot, but this guide only covers responding to incoming messages. How would I send an outbound message that is unsolicited (the bot is on the other persons contact list, just the bot starts the conversation instead of a person). For some reason I just cannot seem to wrap my brain around it. I figure I'll have to make some kind of connection object, give it parameters and pass that on to googles jabber server, but how to do that I have no idea.
Here is the guide I was kinda working with.
And here is the code I have, (pretty much just copied and pasted from the article).
<cffunction name="onIncomingMessage"> <cfargument name="CFEvent" type="struct" required="yes"> <!--- Get the message ---> <cfset var message=CFEvent.data.message> <cfset var originatorID=CFEvent.originatorID> <!--- Result structure ---> <cfset var retValue=structNew()> <cfset retValue.BuddyID= originatorID > <cfset retValue.Message="You said: #message#"> <!--- send the return message back ---> <cfreturn retValue> </cffunction>
So I just need to write a quick function to send a predefined message to a predefined person. Any help is greatly appreciated. Thank you.