Pages

Monday, July 26, 2010

How To Add Sametime Web Awareness to Lotus Connections

View Comments

I while ago I had shared instructions on how to enable STLinks in Lotus Connections. STLinks was a way to add instant messaging awareness to any web application by using pure JavaScript.

Lotus Connections is integrated out of the box with Lotus Sametime. This integration, however, requires that you have the Lotus Sametime client installed, configured, and running in order for the awareness to work. A customer was asking me the other day if we could enable awareness without requiring the Sametime client. The answer is yes.

With the latest Sametime 8.5+ version there's an AJAX API for awareness similar to STLinks. Here's how you can use that API to add awareness in Lotus Connections:

1. Enable SSO between Lotus Connections and Sametime

2. The first step is to initialize the API. Add the following code to header.html

<!-- Adding for Sametime Awareness - START -->
<link rel="stylesheet" type="text/css" href="http://stproxy.acme.com/stwebclient/dojo_1.2.3/sametime/themes/WebClientAll.css" />
<script type="text/javascript">
// Settings for the proxy
var stproxyConfig = {
// Replace with the appropriate server & port
server: "http://stproxy.acme.com",
tokenLogin: true, // We want to not display the login UI
isConnectClient: false
};

// Commmented following line since djConfig is already initialized by Lotus Connections.
// You will receive following error if you don't comment the following lines:
// djConfig.locale is undefined
// sap04/profiles/bundles/js/gzip_238210590/baseBundle.js
//djConfig = {
// parseOnLoad: true
// //isDebug: true
//};
</script>
<script type="text/javascript" src="http://stproxy.acme.com/stbaseapi/baseComps.js"></script>
<script type="text/javascript" src="http://stproxy.acme.com/stwebclient/dojo_1.2.3/sametime/livenameLight.js"></script>
<script type="text/javascript" src="http://stproxy.acme.com/stwebclient/widgets.js"></script>
<script type="text/javascript">
// User ID and password
//var userID = "userID";
//var password = "password";
// Logged in correctly
function loggedInOK() {
// You can do other actions now that you are logged in
}
function logout() {
stproxy.login.logout();
}
// Error callback
function loginFailed(reason, error) {
// Something has gone wrong: display some information
alert("Error: " + reason + ": " + error);
}
// Log in anonymously
function loginUser() {
stproxy.login.loginByToken(null, stproxy.awareness.AVAILABLE, "I'm available", loggedInOK, loginFailed);
return true;
}
stproxy.addOnLoad(loginUser);
</script>
<!-- Adding for Sametime Awareness - END -->

3. Now add the following code anywhere in a page (for example, a blog or a wiki)

<div class="stmain tundra">
<div dojoType="sametime.LiveName" userId="luisb@acme.com"></div>
</div>

4. An alternative is that you would like to add it as field in a user's Profile page. To do so, modify profiles-config.xml to add an attribute that looks like this:

<attribute showLabel="false"
prependHtml="&lt;div class=&quot;stmain tundra&quot;&gt;&lt;div dojoType=&quot;sametime LiveName&quot; userId=&quot;"
appendHtml="&quot;&gt;&lt;/div&gt;&lt;/div&gt;">email</attribute>

Enjoy!

blog comments powered by Disqus