Developers

Creating and Using Modules

LiveChatMax modules are widgets that you can add to your operator panel. You can create general or department only modules for your operators.

What does a module do?

When a chat client start to talk with the operator, we send the client information to the URL you prepared for the module and show the results on the operator panel.

For example you have an existing customer that wants to chat with you. When you create a module, you can show the customers previous or latest orders instantly on your operator window. So that your operator can help your customer more quickly.

How does it work?

First you should create a module on your client panel. A title/name and a valid URL is needed to create a module.

We send your chat client's information with HTTP POST request. You should write a code that use this informations and print the results on this webpage.

Module Variables

{NAME} The chat client's full name.
{EMAIL} The chat client's e-mail address.
{IP} The chat client's IP address
{CUSTOM} Custom key if you've used keys to start a transaction. Learn more about custom key!

How can I code a module?

HTML and JavaScript codes are allowed in module responses. You can use jQuery (you don't need to include the library).

In our sample URL we created a file livechatmax_orders_module.php. Here's an example code:

<?php

 // Deny access if the visitor is not LiveChatMax server!
 if($_SERVER["REMOTE_ADDR"] != gethostbyname("api.livechatmax.com")) {
  header('HTTP/1.0 403 Access Forbidden');
  die("Access Forbidden");
 }

 // Module Start

 // Get the variables
 $email = $_POST["client_email"];
 $name = $_POST["client_name"];

 // Query "orders" table in MySQL server with the given e-mail address
 $results = mysql_query("SELECT * FROM `orders` WHERE `email` = '$email'");
 while($order = mysql_fetch_array($results)) {
  // Print the results
  echo $order["total");
  ...
  ...
  ...
 }