Via Sean, IMified has relaunched their IM integration service as a web based application. More information can be found here: (Re)introducing IMified

Folks may not remember them, but they used to have an event gateway for ColdFusion to handle doing instance messaging work. Their new service is incredibly easier to use now. You simply sign up and then define an IM bot. You can use a bot on their Jabber network (I did cfjeditest@bot.im) as well as working with accounts from AIM, MSN, Yahoo, and GTalk). When you register your bot/application, you define a URL end point. This is a file that will be called whenever someone IMs the account. So let's say you wanted to build an IM bot that returns the current time. How hard is it?

<cfoutput>#now()#</cfoutput>

Yeah, that's real difficult, isn't it? ;) So obviously you can do a bit more. Read the docs for a full explanation, but here are the basics.

Whenever someone IMs your bot, IMified will send to your script a set of values including a unique user key, their message (duh!), and session info including how many times they pinged you and a history of their messages. This allows you to easily do stuff like showing a menu and responding to particular commands.

On the flip side, your server side code can hit IMified for 2 API calls. The first is the ability to get info about the user. This seems to be the same info you get when you right click, get info, on a contact in your favorite IM program. (Adium, right?) The second API call lets you send a message from your bot to a user. You probably wouldn't do that in the script itself, but in a scheduled task or some other file.

Both of these API calls use a simple POST API. But that wasn't simple enough for me. Here are two UDFs I'm using in my test bot.

<cffunction name="getUserDetails" output="false" returnType="struct"> <cfargument name="username" type="string" required="true"> <cfargument name="password" type="string" required="true"> <cfargument name="botkey" type="string" required="true"> <cfargument name="userkey" type="string" required="true"> <cfset var result = ""> <cfset var packet = ""> <cfset var s = structNew()>

<cfhttp url="https://www.imified.com/api/bot/" method="post" result="result" username="#arguments.username#" password="#arguments.password#">

<cfhttpparam type="formfield" name="botkey" value="#arguments.botkey#"> <cfhttpparam type="formfield" name="apimethod" value="getuser"> <cfhttpparam type="formfield" name="userkey" value="#arguments.userkey#"> </cfhttp>

<cfset packet = xmlParse(result.fileContent)>

<cfif structKeyExists(packet, "rsp") and packet.rsp.xmlAttributes.stat is "ok"> <cfset s.status = packet.rsp.user.status.xmltext> <cfset s.screenname = packet.rsp.user.screenname.xmltext> <cfset s.network = packet.rsp.user.network.xmltext> <cfset s.created = packet.rsp.user.created.xmltext> <cfset s.lastonline = packet.rsp.user.lastonline.xmltext> <cfset s.lastcall = packet.rsp.user.lastcall.xmltext> <cfreturn s> <cfelse> <cfthrow message="#packet.rsp.err.xmlAttributes.msg#"> </cfif> </cffunction>

<cffunction name="sendMessage" output="false" returnType="void"> <cfargument name="username" type="string" required="true"> <cfargument name="password" type="string" required="true"> <cfargument name="botkey" type="string" required="true"> <cfargument name="userkey" type="string" required="true"> <cfargument name="message" type="string" required="true"> <cfset var result = ""> <cfset var packet = "">

<cfhttp url="https://www.imified.com/api/bot/" method="post" result="result" username="#arguments.username#" password="#arguments.password#">

<cfhttpparam type="formfield" name="botkey" value="#arguments.botkey#"> <cfhttpparam type="formfield" name="apimethod" value="send"> <cfhttpparam type="formfield" name="userkey" value="#arguments.userkey#"> <cfhttpparam type="formfield" name="msg" value="#arguments.message#"> </cfhttp>

<cfset packet = xmlParse(result.fileContent)>

<cfif packet.rsp.xmlAttributes.stat is "fail"> <cfthrow message="#packet.rsp.err.xmlAttributes.msg#"> </cfif> </cffunction>

And here is how my bot uses it: (Note I've masked my password and botkey)

<cftry> <cfset info = getUserDetails("ray@camdenfamily.com","isecretelyusephp","xxx", form.userkey)> <cfoutput>Hello, #info.screenname#. I see you came from #info.network#. Your last call was #info.lastcall#</cfoutput> <cfset sendMessage("ray@camdenfamily.com","dotnetmakesmeahem", "xxx", form.userkey, "Why did you say #form.msg# to me?")> <cfcatch> <cfoutput>oops! #cfcatch.message#</cfoutput> </cfcatch> </cftry>

The service is currently in beta, and free. The blog entry says it will be a pay service soon, but a free version will still be offered. I've got to say - Kudos to these guys. They made a system that is so easy even a PHP coder can use it!