Having your blog display your AIM away message using the WIM API is a pretty simple operation. If you don't have an API key, you can grab one from developer.aim.com.
Follow these steps to get it up and running:
<script type="text/javascript" src="http://o.aolcdn.com/aim/web-aim/aimapi.js"></script>
<script type="text/javascript">
// Register a callback for the getPresenceInfo transaction
AIM.params.callbacks.getPresenceInfo = ["awayMessageWidget.displayAwayMessage"];
var awayMessageWidget = {
// Our init function, called from the window's onload event.
init: function() {
// Our API key. Be sure to change this to your own
AIM.params.wimKey = "sc1OCxN4ASAnSDj1";
// Call the getPresenceInfo transaction
AIM.transactions.getPresenceInfo();
},
// This function is the callback for our transaction. It takes the json response from the host as its argument
displayAwayMessage: function(json) {
// Only do stuff if the back-end tells us everything is Ok
if(json.response.statusCode==200) {
// Only do stuff if the satus of the user is "away"
if(json.response.data.users[0].state == "away") {
// grab the away message from the response and stick it in the "myAwayMessage" element.
document.getElementById("myAwayMessage").innerHTML = "My away message: " + json.response.data.users[0].awayMsg;
}
}
}
}
// attach the init function to the onload event of the window
window.addEventListener?window.addEventListener("load",awayMessageWidget.init,false):window.attachEvent("onload",awayMessageWidget.init);
</script>
<div id="myAwayMessage" class="AIMPresenceWidget schipman8"></div>
If you aren't away or the backend returns an error code, nothing will be displayed. Feel free to modify this code to your hearts content. Enjoy!