Nicholas Chase has published an interesting article on IBM Developerworks. It's about making it possible to chat with people in Second Life (SL), without opening SL program. That's a rather innovative solution and I think that many SL users would appreciate such possibility.
It works like this:
1) SL person clicks an object (a picture, a cube) which says "Type message now and it will be send to John Doe"
2)SL person types the message, like "Hi John, can you hear me?", while being near the object.
3)The object can "see" the typed text and sends it to a web servlet using HTTP call. Web server has a connection to Sametime server through Sametime bot.
4) Sametime bot forwards the message to John Doe, who is logged in on Sametime network.
5) John Doe has his Sametime client started and receives a message from Sametime Bot, saying "Hi John, can you hear me?".
6) John Doe types "Yes, how can I help you?" as the response to bot in the Sametime client chat window.
7) Bot outputs the answer to the servlet and the servlet outputs it back to the requesting SL object.
8) The object shows message "Yes, how can I help you?" in SL. Anyone near the object can see the message. So you actually do not chat with the person, but with the object itself, which "broadcasts" your message to all people nearby. I think your response message can in theory also be a private message send only to that person, but the person's request message is always visible to others.
http://www-128.ibm.com/developerworks/edu/ls-dw-ls-stsl.html
I will try to implement the suggested solution and see if it can be used for something more useful than spam-chatting with people near chatboxes :)
Like having a "chat conference meeting" where people do not need to be logged in to SL, and actually do not even need an SL account. Can be interesting solution for chat-only SL meetings hold by companies like IBM. It should be possible to sort away chats from people other than the meeting's chairman. Just imagine an online conference where instead of people's avatars you see a lot of chatting cubes :)
I will also try to connect the solution to my company's Sametime Botand use STWidget as a chat client. Having AJAX/Flash-based STWidget web client as chat interface would eliminate the need to download and install Sametime client.
There are thousands of virtual shops in SL selling virual clothes, virtual furniture and stuff, and some shop owners would probably like to have an option to chat with customers even when they are not logged in to SL. Not sure if there is already some software for this #.
Following things are to consider when developing SL-to-Sametime chat solution for more than 1 user:
* Noone in SL knows what Sametime is and don't care much either. A Sametime-less option would be great (Apache+MySQL+PHP).
* Sametime bot must be hosted somewhere.
* Same Sametime bot should be able to handle tens of thousands of objects and hundreds of simultaneous chats. I guess our Sametime bot can be extended for this purpose, but it's still a difficult task. Probably several bots at several locations would be needed.
* People do not have Sametime client and don't want one. Can be solved with STWidget though.
* People do not have access to Sametime servers. Can be temporary solved by using IBM's demo server.
* The biggest question: will Sametime add too much overhead to the solution, without actually making it easier to develop and maintain? Theoretically a message can be sent directly to STWidget chat client without going through Sametime network.
I'll publish the results of my tests.
Tags: sametime sametime bot
Showing posts with label Sametime. Show all posts
Showing posts with label Sametime. Show all posts
Friday, May 18, 2007
Sunday, January 21, 2007
Notify database responsible person about new documents using Sametime
Imagine that you are responsible for a Domino application where users can register themselves and you want to get notified about about new registrations as soon as possible.
Screenshot of the demo application:

This can be done by sending an email message in WebQuerySave event or SMS message, but it has its disadvantages. Sending by email can give several minutes of delay, and receiving 20 SMS per hour can be annoying. Using Sametime messages for notification is not as disturbing as beeping SMS messages and also ensures instant delivery.
One more way to see the latest registrations is to use a Sametime bot to get a quick overview of the latest registrations without opening the database in Notes client.
Let's see how you can use tools provided by Botstation Technologies (all available as free trial) to accomplish these tasks.
1) Immediate notification when user saves his registration
2) Course administrator gets latest results by asking Sametime bot
Immediate notification
To immediately notify the responsible person about new registration, all you need to do is add a couple of code lines into your WebQuerySave agent. The code uses STAgent script library, which contains the most popular functions for working with Sametime. You can easily send a Sametime message to the specified person:
Here is an example:
Dim STAgent as New STAgent()
Call STAgent.login("stserver.company.com", "Notification Agent", "password")
Call STAgent.sendMessage("Admin Doe", "New registration: "+doc.CourseDate(0)+" / "+doc.CreatedBy(0)+" / "+doc.Subject(0))
Call STAgent.logout()
The recipient immediately gets a Sametime message showing registration details and can take an appropriate action if needed.
If you have several responsible persons and want to send the notification message only to one of them, you can send the message only to the first person whos Sametime online availability status is set to Active. You can query the online status with this code line:
onlinestatus=STAgent.getOnlineStatus("Admin Doe") 'Active, Away, Offline
You can download an evaluation version of the STAgent and try by yourself in your own agents.
Notification on demand
Instead of sending a Sametime message immediately after each registration, you can query Sametime Bot to get the new registrations since last the query time. Sametime Bot from our company Botstation Technologies is able to run ordinary LotusScript agents, which makes it possible to accomplish this task in just 5 minutes. Same solution can be re-used later in similar applications. You can also restrict access to this particular bot functionality to only certain persons.
"Access properties" screenshot:

To ask bot for new registrations, you simply choose bot from your buddy list and type "registrations" to him. Bot receives your message and immediately answers with a list of last registrations.
To make this work, all you need to do is to create a LotusScript agent which searches for documents created after agent's last run time and then create a Question mapping in the bot's configuration database.
To create a bot question which triggers an agent, you specify keywords (e.g. "registrations", "bookings") and choose an agent from a list of available agents. See the picture below.
Sub Initialize
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.CurrentAgent
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = db.GetDocumentByID(agent.ParameterDocID)
tmp= AgentMain(doc)
doc.AgentResult=tmp
doc.savedbyagent="Yes"
Call doc.Save(True,False)
End Sub
Function AgentMain(doc As notesdocument) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim coursedb As notesdatabase
Dim coll As NotesDocumentCollection
Dim coursedoc As NotesDocument
Dim agent As NotesAgent
Set db=doc.ParentDatabase
Set coursedb=New NotesDatabase(db.server, "coursereg.nsf")
Set agent=session.CurrentAgent
Set dateTime = New NotesDateTime(agent.LastRun )
Set col=coursedb.search(|Form="Document"|, dateTime, 0)
Set coursedoc=col.GetFirstDocument
tmp="No new registrations found since "+Cstr(agent.LastRun)
If col.count>0 Then tmp="Found "+Cstr(col.count)+" new registrations since"+Cstr(agent.LastRun)+"<br>"
While Not coursedoc Is Nothing
tmp=tmp+coursedoc.CourseDate(0)+" / "+coursedoc.CreatedBy(0)+" / "+coursedoc.CourseName(0)+"<br>"
Set coursedoc=col.GetNextDocument(coursedoc)
Wend
AgentMain=tmp
End Function
I've created a live demonstration of this functionality using the code above, you can try it here: live demo of Sametime bot reading the registration database
To emulate the real application, the bot in the demo application adds a random number of new documents (1-5) after each run. So every time you issue "registrations" command to bot, you will get some unique results.
Screenshot:

Tags: sametime sametime bot
Screenshot of the demo application:

This can be done by sending an email message in WebQuerySave event or SMS message, but it has its disadvantages. Sending by email can give several minutes of delay, and receiving 20 SMS per hour can be annoying. Using Sametime messages for notification is not as disturbing as beeping SMS messages and also ensures instant delivery.
One more way to see the latest registrations is to use a Sametime bot to get a quick overview of the latest registrations without opening the database in Notes client.
Let's see how you can use tools provided by Botstation Technologies (all available as free trial) to accomplish these tasks.
1) Immediate notification when user saves his registration
2) Course administrator gets latest results by asking Sametime bot
Immediate notification
To immediately notify the responsible person about new registration, all you need to do is add a couple of code lines into your WebQuerySave agent. The code uses STAgent script library, which contains the most popular functions for working with Sametime. You can easily send a Sametime message to the specified person:
Here is an example:
Dim STAgent as New STAgent()
Call STAgent.login("stserver.company.com", "Notification Agent", "password")
Call STAgent.sendMessage("Admin Doe", "New registration: "+doc.CourseDate(0)+" / "+doc.CreatedBy(0)+" / "+doc.Subject(0))
Call STAgent.logout()
The recipient immediately gets a Sametime message showing registration details and can take an appropriate action if needed.
If you have several responsible persons and want to send the notification message only to one of them, you can send the message only to the first person whos Sametime online availability status is set to Active. You can query the online status with this code line:
onlinestatus=STAgent.getOnlineStatus("Admin Doe") 'Active, Away, Offline
You can download an evaluation version of the STAgent and try by yourself in your own agents.
Notification on demand
Instead of sending a Sametime message immediately after each registration, you can query Sametime Bot to get the new registrations since last the query time. Sametime Bot from our company Botstation Technologies is able to run ordinary LotusScript agents, which makes it possible to accomplish this task in just 5 minutes. Same solution can be re-used later in similar applications. You can also restrict access to this particular bot functionality to only certain persons.
"Access properties" screenshot:

To ask bot for new registrations, you simply choose bot from your buddy list and type "registrations" to him. Bot receives your message and immediately answers with a list of last registrations.
To make this work, all you need to do is to create a LotusScript agent which searches for documents created after agent's last run time and then create a Question mapping in the bot's configuration database.
To create a bot question which triggers an agent, you specify keywords (e.g. "registrations", "bookings") and choose an agent from a list of available agents. See the picture below.
Sub Initialize
Dim s As New NotesSession
Dim agent As NotesAgent
Set agent = s.CurrentAgent
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = db.GetDocumentByID(agent.ParameterDocID)
tmp= AgentMain(doc)
doc.AgentResult=tmp
doc.savedbyagent="Yes"
Call doc.Save(True,False)
End Sub
Function AgentMain(doc As notesdocument) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim coursedb As notesdatabase
Dim coll As NotesDocumentCollection
Dim coursedoc As NotesDocument
Dim agent As NotesAgent
Set db=doc.ParentDatabase
Set coursedb=New NotesDatabase(db.server, "coursereg.nsf")
Set agent=session.CurrentAgent
Set dateTime = New NotesDateTime(agent.LastRun )
Set col=coursedb.search(|Form="Document"|, dateTime, 0)
Set coursedoc=col.GetFirstDocument
tmp="No new registrations found since "+Cstr(agent.LastRun)
If col.count>0 Then tmp="Found "+Cstr(col.count)+" new registrations since"+Cstr(agent.LastRun)+"<br>"
While Not coursedoc Is Nothing
tmp=tmp+coursedoc.CourseDate(0)+" / "+coursedoc.CreatedBy(0)+" / "+coursedoc.CourseName(0)+"<br>"
Set coursedoc=col.GetNextDocument(coursedoc)
Wend
AgentMain=tmp
End Function
I've created a live demonstration of this functionality using the code above, you can try it here: live demo of Sametime bot reading the registration database
To emulate the real application, the bot in the demo application adds a random number of new documents (1-5) after each run. So every time you issue "registrations" command to bot, you will get some unique results.
Screenshot:

Tags: sametime sametime bot
Labels:
Sametime,
Sametime API,
Sametime bot
Sunday, January 14, 2007
Sametime-related error messages at console after removing Sametime server
If you uninstalled Sametime server from Domino server, or manually removed Sametime task, you can sometimes get following error messages in Domino console:
FAILURE - lRes:2 hKey:0
hRoot:-2147483646 szKey:[SOFTWARE\Lotus\Sametime\STDiagViewer\STDiag1\]
FAILURE - lRes:2 hKey:0
hRoot:-2147483646 szKey:[SOFTWARE\Lotus\Sametime\STDiagViewer\STDiag1\UTIL Configuration API]
These messages are show during the startup of the server. They are not logged in the log.nsf database and can only be seen on console.
In my particular case the Sametime was "removed" by deleting all Sametime-related entries in notes.ini, deleting sametime entry in Windows registry and deleting STADDIN task from the list of tasks in notes.ini.
After searching the Internet, I could not find any solutions to get rid of the irritating console error messages, so I had to investigate it myself. It took a couple of hours to eliminate possible causes and at last I found the solution:
Remove "scs" parameter from servlets.startup= row in servlets.properties file and the error messages will dissapear.
While you are editing servlets.properties file, delete other Sametime-related parameters which IBM masqueraded as important Domino tasks to fool the unsuspecting admins:
auth admin mmapi stcal fileupload rapfile
Usually there are only Sametime-related entries in servlets.properties, so you can probably just delete everything you can see in the file.
If you are getting mentioned error messages even after the startup, this means that users are still trying to access the sametime server using Java Connect client. Delete stsrc.nsf database (which contains the HTML form for launching the Connect client) and the messages will dissapear.
Read more about Sametime servlets here: http://www-128.ibm.com/developerworks/lotus/library/ls-STservlets/index.html
Tags: sametime
FAILURE - lRes:2 hKey:0
hRoot:-2147483646 szKey:[SOFTWARE\Lotus\Sametime\STDiagViewer\STDiag1\
FAILURE - lRes:2 hKey:0
hRoot:-2147483646 szKey:[SOFTWARE\Lotus\Sametime\STDiagViewer\STDiag1\UTIL Configuration API]
These messages are show during the startup of the server. They are not logged in the log.nsf database and can only be seen on console.
In my particular case the Sametime was "removed" by deleting all Sametime-related entries in notes.ini, deleting sametime entry in Windows registry and deleting STADDIN task from the list of tasks in notes.ini.
After searching the Internet, I could not find any solutions to get rid of the irritating console error messages, so I had to investigate it myself. It took a couple of hours to eliminate possible causes and at last I found the solution:
Remove "scs" parameter from servlets.startup= row in servlets.properties file and the error messages will dissapear.
While you are editing servlets.properties file, delete other Sametime-related parameters which IBM masqueraded as important Domino tasks to fool the unsuspecting admins:
auth admin mmapi stcal fileupload rapfile
Usually there are only Sametime-related entries in servlets.properties, so you can probably just delete everything you can see in the file.
If you are getting mentioned error messages even after the startup, this means that users are still trying to access the sametime server using Java Connect client. Delete stsrc.nsf database (which contains the HTML form for launching the Connect client) and the messages will dissapear.
Read more about Sametime servlets here: http://www-128.ibm.com/developerworks/lotus/library/ls-STservlets/index.html
Tags: sametime
Friday, January 12, 2007
Sametime bot finds zip code with @DBLookup
Based on Thomas Adrian's Swedish postcodes database, I've created a function for our company's Sametime bot which returns the post codes(zip codes) for a specified city or the city name by specified zip code. All you need to implement this functionality in the free evaluation version of Botstatiuon Bot is to create a "pattern answer" with @formula which makes lookup to the database. Similar formula can be used for any database lookup from bot. Later I will add bot function to lookup for phone area codes for cities in USA and Sweden.
With Sametime Widget (STWidget) AJAX-based tool you can make a live test of the function.
Commands you can type to bot:
postcode 18200
postcode Danderyd
zip 14700
zip tumba
And of course the most popular "joke" command which shows you a random joke every time you type it :)
TRY HERE: http://www.botstation.com/products/stweb/stwidget_zip.html
-------------------------------------
city:=@ReplaceSubstring(@Trim(@Right(@RequestText;" "));" ";"-");
tmp:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By city";city;2);
@If(@IsError(tmp); @If(@Length(city)!=5;@Return("Postnumber not found for city "+city);"");@Return("Zip code(s) for "+city+": "+@Implode(@Sort(@Unique(tmp));", ")+"<br>--------------<br>You can also try reversed command:
postnumber "+@Subset(tmp;1)));
tmp1:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By number";city;2);
@If(@IsError(tmp1);"City for postnumber "+city+" not found"; "City for postcode "+city+": "+@Implode(tmp1;", ")+"<br>--------------<br>You can also try reversed command:<br>postnumber "+@Subset(tmp1;1))
-------------------------------------
@RequestText function above is translated by Bot into the incoming command text, for example "zip 12345".
Screenshot of Bot's answer configuration page:

An alternative way to find zip code is to make call to a Web Service, which is also possible with Botstation Sametime Bot, I'll show how to accomplish it in some of the posts later this month.
Related posts:
Sametime bot shows a random Bible quote
Merry Christmas from Sametime Bot
Tags: sametime sametime bot
With Sametime Widget (STWidget) AJAX-based tool you can make a live test of the function.
Commands you can type to bot:
postcode 18200
postcode Danderyd
zip 14700
zip tumba
And of course the most popular "joke" command which shows you a random joke every time you type it :)
TRY HERE: http://www.botstation.com/products/stweb/stwidget_zip.html
-------------------------------------
city:=@ReplaceSubstring(@Trim(@Right(@RequestText;" "));" ";"-");
tmp:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By city";city;2);
@If(@IsError(tmp); @If(@Length(city)!=5;@Return("Postnumber not found for city "+city);"");@Return("Zip code(s) for "+city+": "+@Implode(@Sort(@Unique(tmp));", ")+"<br>--------------<br>You can also try reversed command:
postnumber "+@Subset(tmp;1)));
tmp1:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By number";city;2);
@If(@IsError(tmp1);"City for postnumber "+city+" not found"; "City for postcode "+city+": "+@Implode(tmp1;", ")+"<br>--------------<br>You can also try reversed command:<br>postnumber "+@Subset(tmp1;1))
-------------------------------------
@RequestText function above is translated by Bot into the incoming command text, for example "zip 12345".
Screenshot of Bot's answer configuration page:

An alternative way to find zip code is to make call to a Web Service, which is also possible with Botstation Sametime Bot, I'll show how to accomplish it in some of the posts later this month.
Related posts:
Sametime bot shows a random Bible quote
Merry Christmas from Sametime Bot
Tags: sametime sametime bot
Subscribe to:
Posts (Atom)
