Export customers to CSV file

Let's imagine you want to export your contacts with their names and contact details to a csv file. LiveAgent user interface currently doesn't offer the option to do this so here is a short example on how to export all contacts with their contact information using REST API calls: <?php //URL TO YOUR LIVEAGENT INSTALLATION WITH LAST TRAILING SLASH const LIVEAGENT_API_URL = 'https://www.example.com/'; //YOUR API KEY YOU CAN FIND IN MENU Configuration -> System -> Api const API_KEY = '...

Export Conversations to CSV file

Let's imagine you want to export conversations of specific department for certain date range to csv file. LiveAgent user interface doesn't offer the option to export tickets into csv, because it can potentially generate Gigs of data, which you will not be able to download using browser. The best way to export such amount of data is to use REST API calls. Here is short example how to export all data from tickets, which passed certain criteria: <?php //URL TO YOUR LIVEAGENT INSTALLATION co...

How to create Live Chat button using REST API

You can add live chat button (https://www.liveagent.com/features/real-time-chat/) via PHP and LiveAgent REST API: <?php $ch = curl_init(); $curl_post_data = array( /* These are mandatory params */ 'name' => 'MyButton4', 'provide' => 'BFC', 'departmentid' => 'dep1', 'rtype' => 'C', 'usecode' => 'N', 'status' => 'A', 'apikey' => '<YOUR_API_KEY>', /* ...and these are optional */ 'contactwidgetid' => '', 'kb_id' => 'kb1', 'description' => 'desc', 'language' =...

Single sign-on example for WordPress

In this example we'll show you how can you implement simple SSO for your admins in Wordpress. As result, they will be able to access LiveAgent admin panel directly from their admin menu. Goal: Adminstarators and editors from WordPress can go to LiveAgent panel without logging in through log-in dialog. Requirements: - Administrators in WordPress must have the same e-mail address as their username in LiveAgent So here is the code of very basic WordPress plugin handling SSO for all adm...

Automatic subscribers recognition in LiveAgent Knowledgebase for WordPress

In this example we'll show you how can you implement recognition of your subscribers in WordPress as regular customers in LiveAgent. As a result, your subscribers can visit LiveAgent Knowledgebase and see their own tickets and interact with them. Goal: Each subscriber will be registered also in LiveAgent with his email. As a result, after login in WordPress they can move freely to LiveAgent Knowledgebase and work with their tickets. Requirements: - your WordPress installation and your...

Online agents widget for WordPress

In this example we create a plugin that shows which agents are in specific department, and what is their actual status. You can see result on screenshot bellow: And we'll be able to configure which department we want to show in backend: Goal: We want to be able to show agents and their statuses in any department. And we want to see this in WordPress sidebar widget. Requirements: none Plugin code: <?php /* Plugin Name: LiveAgent example 4 Plugin URI: https://www.quali...

Retrieve the details of a conversation (ticket)

The following sample code shows how to retrieve the details of a conversation (ticket) <?php $LAURL ="https://URL_TO_LiveAgent"; $APIKEY = "ae07484cf29d087d70554b1d5f347ac7"; $conversationID = 'b0dfff7c'; // service URL based on: // https://support.qualityunit.com/840770-Complete-API-reference#87abf7ff1b8dd576caf5194e502354cf $service_url = $LAURL.'/api/conversations/'.$conversationID.'?apikey='.$APIKEY; $curl = curl_init($service_url); // curl POST request based on: // https://support.q...

Single sign-on generic example

In this example we'll show you how you can implement simple single sign-on (SSO) for any kind of PHP-based webpage/application. As a result, users of your php-based webpage/app can access LiveAgent KnowledgeBase or LiveAgent Agent panel directly through a link without going through the generic login process. Requirements - Users in php-based page/webapp must have the same e-mail address as their registered username/email in LiveAgent. - Customers in LiveAgent must be REGISTERED! You can au...

API call to create conversation from PHP

Here is a short example how to call LiveAgent API and create a conversation with custom fields. <?php $service_url = 'https://localhost/LiveAgent/LiveAgent/server/api/index.php?handler=conversations'; $curl = curl_init($service_url); //use custom field codes defined by administrator, otherwise they will not be visible in ticket detail (but still inserted to DB) $arrcustomVars = array(array('code'=>'varsymbol', 'value'=>'43894209'), array('code'=>'anotherfield', 'value'=>...