How can I run an Instant Messaging Applet on my web site?

  1. Home
  2. Knowledge Base
  3. GMS
  4. How can I run an Instant Messaging Applet on my web site?

Question

I have seen a number of web sites that allow Instant Messaging sessions to be opened directly from the web site to members of that organizations sales or support teams?

Is this possible with GMS Instant Messenger and if so how do I do it?

Answer

Yes. This is straightforward to set up and you can see a working copy of this feature on our website at http://www.Gordano.com
by clicking on the "IM Sales" button on the top right hand side of the index page.

This feature has proved to be very popular with customers who are in need of maintaining a direct "presence" online for both prospective and existing customers to be able to easily contact staff.

To get this facility operational on your own web site you will need to write one MML page and one HTML page, examples of both are given below.

In these examples I have called the MML page "im.mml" and this page needs to be placed in the MML directory on the server running GMS. This server does need to be accessible from the Internet. This MML script is then called from any web server using an anchor tag as shown in the example HTML file which I have called "callim.htm".

You should be able to run the HTML file on any web server. It does not have to be a GMS server or even a server on the same network as GMS.

The accounts user1, user2 etc. specified in the MML file need to be set up on the GMS server, and are the
accounts to be used for the anonymous access (the customers). The passwords for those accounts need to match the passwords specified in the MML page so change as necessary.

The syntax in your MML is as follows – useremailaddress:userpassword:displayname. So in the example below:

user1@test.dom:password:Guest1

the logon will take place for "user1" with a password of "password" and the user will display in Instant messenger as "guest1".

Any preferences set for these accounts
will apply to the IM client opened for the customer so please set permissions appropriately.

The accounts staff1, staff2 etc. defined within the MML file need to be real user accounts within the company. These should be the staff or people that you want to handle the IM calls from customers as they come through.

If a member of staff listed is not logged on to GMS Instant Messenger the applet will not try and contact them. They will also not be contacted if they are marked as busy, away from their desk etc. within GMS Instant Messenger. Staff should change their IM status appropriately throughout the day.

Example MML File
(Should be saved in the gordanomml directory)

<#
definclude "/webmail/common/dialogfunctions.mml";
definclude "/webmail/common/windowfunctions.mml";
definclude "/webmail/common/menufunctions.mml";
onceinclude "/webmail/common/javascriptfunctions.mml";

applvlist =
   URLEncode(weakencryptvalue("user1@test.dom:password:Guest1")) & "," &
   URLEncode(weakencryptvalue("user2@test.dom:password:Guest2")) & "," &
   URLEncode(weakencryptvalue("user3@test.dom:password:Guest3")) & "," &
   URLEncode(weakencryptvalue("user4@test.dom:password:Guest4")) & "," &
   URLEncode(weakencryptvalue("user5@test.dom:password:Guest5")) & "," &
   URLEncode(weakencryptvalue("user6@test.dom:password:Guest6"));
#>

<html>
<head>
<title>IM Session</title>
</head>
<body>
<form name=clientform method=post action="/messenger/masterwindow.mml"
   target="_blank" onSubmit="return false;">
<applet name="messagedialog" mayscript CODE="MessageDialog.class"
   codebase="/java/messagedialog" WIDTH=100% HEIGHT=100%
   archive="messagedialog.jar">
   <param name="language" value="<# print(CurrentLanguage); #>">
   <param name="connectingstring" value="Connecting to Server...">
   <param name="loggingonstring" value="Logging on...">
   <param name="failurestring" value="There are no free staff,
       please try later.">
   <param name="contactEmails" value="staff1@test.dom,staff2@test.dom,
       staff3@test.dom,staff4@test.dom,staff5@test.dom,staff6@test.dom">
   <param name="productname" value="<# print(messenger_product_name);
      #>">
   <param name="alertscript" value="alertHandler">
   <param name="applv" value="<# print(applvlist); #>">
   <param name="checksubstatus" value="yes">
</applet>
</form>
</body>
</html>

Example HTML File
(Should be saved on your web site as callim.htm)

<script language=JavaScript type="text/javascript">
<!--
function IMWindow(IM)
{
MyWindow = window.open(IM,'Window','toolbar=no,resizable=no,location=no,
    scrollbars=no,width=425,height=320')
MyWindow.focus()
}
-->
</script>
<html>
<body>
<a href="javascript:IMWindow ('http://localhost:8000/im.mml')"
    onMouseOut="self.status='" onClick="self.status='Instant Message'"
    onMouseOver="self.status='Instant Message'; return false"
    title="Instant Message">Open IM Session</a>
</body>
</html>

Note:
If your web server is behind a firewall, you will need to open port 8367 to allow IM traffic.

Keywords:Instant messaging applet web site im www imsales website

Was this article helpful?

Related Articles