I'm planning to write a mobile app and would like to use Desktop client API, what I have to know?

Last modification: 2014-02-08 09:12:40

Desktop client uses lhxml module and all data is exchanged in JSON format. Just missleading module name.

Things to know

1. Desktop client always during request provides username and password.

$_POST['username'] 
$_POST['password']

Here is list of possible requests url

  1. http://demo.livehelperchat.com/xml/checklogin it accepts only $_POST['username'],$_POST['password'] as arguments and returns {"result":false} or {"result":true} . This is very first reques which get's executed opn mobile desktop app initial start.
  2. http://demo.livehelperchat.com/xml/accepttransfer/<transfer_id> accepts transfered chat. returns {"error":false} if everything is ok.
  3. http://demo.livehelperchat.com/xml/accepttransferbychat/<chat_id> accepts transfered chat also, but this time argument is chat_id
  4. http://demo.livehelperchat.com/xml/addmsgadmin/<chat_id> to this url also has to be provided $_POST['msg'] returns nothing. Because sync request will fetch next message.
  5. http://demo.livehelperchat.com/xml/chatdata/<chat_id>  returns chat data which JSON looks like
    1. (array('error' => false, 'canned_messages' => $cannedmsg, 'chat' => $chat, 'ownerstring' => $ownerString) canned_messages is an array and chat is an object.
    2. array('error' => true,'error_string' => 'You do not have permission to read this chat!') - this string is returned if user does not have permission to open this chat.
    3. This request is executed upon initial chat window or tab open to get main chat information.
  6. http://demo.livehelperchat.com/xml/chatssynchro to this url request is executed every 3.5 seconds it chat messages synchronization call.
    1. $_POST['chats']   = '6|5,1,4;8|0,5,2,0,5,2'; This is example of data which have to be provided. by ";" is separated chat's. By | is separated chat_id and last synchronization messages. Actually not sure so many messages like there should be only one.
    2. So in this case, we ask messages for two chats 6 and 8 and and all messages from 1 message id 6 chat case, and messages where id >= 0 and chat id is 8. In general our request should look like. $_POST['chats'] = '6|1;8|0';
    3. Response is 
    4. $arrayReturn[$chat_id]['messages'] = $chatsMessages; // Chat messages array of messages object
    5. $arrayReturn[$chat_id]['chat_status'] = $chatStatusMessage; // And chat status message.
  7. http://demo.livehelperchat.com/xml/closechat/<chat_id> - Closes a chat. Returns nothing.
  8. http://demo.livehelperchat.com/xml/deletechat/<chat_id> - Deletes a chat. Returns nothing.
  9. http://demo.livehelperchat.com/xml/getuseronlinestatus - Get's currenly logged online user status. Has he checked Offline or Not.
    1. Returns array('online' => $userData->hide_online == 1) false or true
  10. http://demo.livehelperchat.com/xml/lists - Returns lists of chats. json_encode(array(
    'active_chats' => array('rows' => $activeChats, 'size' => count($activeChats), 'hidden_columns' => $columnsToHide, 'timestamp_delegate' => array('time'),'column_names' => $columnsName),
    'online_users' => array('rows' => $onlineUsers, 'size' => count($onlineUsers), 'hidden_columns' => $onlineuserscolumnsToHide,'column_names' => $onlineuserscolumnsNames, 'timestamp_delegate' => array('last_visit','first_visit')),
    'closed_chats' => array('rows' => $closedChats, 'size' => count($closedChats), 'hidden_columns' => $columnsToHide, 'timestamp_delegate' => array('time'),'column_names' => $columnsName),
    'pending_chats' => array('rows' => $pendingChats, 'size' => count($pendingChats), 'hidden_columns' => $columnsToHide, 'timestamp_delegate' => array('time'),'column_names' => $columnsName),
    'transfered_chats' => array('rows' => $transferedChats, 'size' => count($transferedChats), 'hidden_columns' => array_merge($columnsToHide,array('transfer_id')), 'timestamp_delegate' => array('time'),'column_names' => $columnsName),
    ));
  11. http://demo.livehelperchat.com/xml/sendnotice/<online_user_id> - send's message to online user. $_POST['msg'] also has to be provided.
  12. http://demo.livehelperchat.com/xml/setonlinestatus/<status> - set's current user status 0 - offline, 1 - offline this call is used in application to switch from offline to online.
  13. http://demo.livehelperchat.com/xml/transferchat - get's online operators list. This list is used later to transfer a chat to selected operator
  14. http://demo.livehelperchat.com/xml/transferuser/<chat_id>/<user_id> - transfers chat to seleceted operator.
  15. http://demo.livehelperchat.com/xml/userinfo/<online_user_id> array('user' => $tpl->fetch()) return plain text of online user info.

And that's all what you need to know building mobile APP.

Support project

Developing application takes a lot of time. You can support application by donating. There is no company behind this application and it takes away my free time. Every donation matters and does not matter how small it is!


Paypal, one time donation
Monthly donation
Bitcoin
Skrill
remdex@gmail.com


comments powered by Disqus