Integre o Livezilla com seu Software via API
API LiveZilla Widget
A API LiveZilla Widget permite que você aplique configurações ou altere aspectos visuais no local por meio de chamadas de Javascript. Certifique-se de que o código do botão de bate-papo do LiveZilla (versão 7.1.0.1 e superior) esteja integrado na página onde você deseja acessar a API.
Dados privados
Se você tiver cookies configurados como "Opt-In", esta chamada ativa o uso de cookies.
Cookie Opt-In
Se você tiver cookies configurados como "Opt-In", esta chamada ativa o uso de cookies.
Cookie Opt-In
Se você tiver cookies configurados como "Opt-Out", esta chamada remove todos os cookies e garante que nenhum outro cookie será definido.
Cookie Opt-Out
O monitoramento do visitante será desativado para o visitante para sempre.
Monitoramento de visitante / desativação de rastreamento
Data Pass-Thru
Use esta função para alterar detalhes do visitante, como nome ou e-mail, passando um objeto de dados. Observe esta entrada de FAQ .
Alterar / definir detalhes do visitante
Controles de interface de usuário de widget
Certifique-se de ativar o "Modo API" ao criar seu código de botão de bate-papo no Gerador de links LiveZilla
Mostrar widget
Ocultar widget
Alternar serviço de widget
Eventos
Executar Evento
LiveZilla Chat Bot API
Chat Bot API Information and Usage
This is the documentation for the LiveZilla Chat Bot API included from 7.0.5.0. Please read the contents of this page carefully.
While the LiveZilla Chat Bot in its standard setting is able to browse the Knowledge Base, you can use the Chat Bot API in order to perform more complex processes. The logic of the Chat Bot API needs to be placed inside a separate ChatBot script (e.g. PHP).
Each Chat Bot can have its own script which needs to be saved as an absolute URL (see Bot Account in User Management).
The Chat Bot API is supposed to exchange data between the LiveZilla server and the Chat Bot script as well as visualizing it on the user side. Each inquiry consists of two objects (REQUEST and RESPONSE) which are exchanged in JSON format via POST. The user input (REQUEST) is sent to the Chat Bot script which processes it and immediately sends the RESPONSE.
All errors will be logged in _log/error_php.log.
JSON Key | Type | Comment | Example |
---|---|---|---|
RequestNumber | int | Requests serial number starting with 0 | 0 |
ResponseTo | string | Last Response ID | R7546584783 |
Value | string | Visitors input | Hi, this is a test |
BotId | string | ID of Bot | b23d62db4063344 |
BotName | string | Name of Bot | Example Bot |
VisitorName | string | Name of Visitor | John |
VisitorId | string | ID of Visitor | v23d62db4063344 |
GroupId | string | ID of Group | support |
HumanAvailable | bool | Human operator is available | true |
Language | string | Visitor Language (ISO 639-1 Code) | FR |
Operators | array(operator) | Operator List | [operator1, operator2] |
Tag | object | Tag from last Response | {prop:value,…} |
KBMatchCount | int | Number of knowledge base entries matching request | 3 |
When visitors end the chat, an Exit Message with the value “[__[EXIT]__]” will be sent to your script automatically.
JSON Key | Type | Comment | Example |
---|---|---|---|
Id | string | Operator ID | john_doe |
Fullname | string | Name of operator | John Doe |
Status | string | 0 | 1 | 2 | 3 (Online, Busy, Offline, Away) | 0 |
Groups | array(string) | List of groups this operator is a member of | [“support”, “tech”] |
JSON Key | Type | Required | Comment | Example |
---|---|---|---|---|
Id | string | Yes | Alphanumeric ID, max 32 chars | R7546584783 |
Value | string | No | General response text (HTML) | Hi, this is my answer |
Select | array(Button) | No | Button list | [button1, button2] |
SearchKB | bool | No | Search knowledge base and add results | false |
Block | bool | No | Block input field | false |
Action | chat | message | No | Start chat with human or leave a message | chat |
Operator | string | No | Action target operator (ID) | john_doe |
Group | string | No | Action target group (ID) | support |
Data | array(int,string) | No | Store visitor information | [111=>”John”, 112=>”[email protected]”] |
Tag | object | No | Tag to be returned with next Request | {prop:value,…} |
JSON Key | Type | Required | Comment | Example |
---|---|---|---|---|
Title | string | Yes | Button title (HTML) | Button 1 |
Return | string | No | The value sent back as response after click | |
URL | string | No | URL to be opened on click | http://… |
Script | string | No | Javscript code to be executed on click | alert(123); |
Action | chat | message | No | Start chat with human or leave a message | chat |
Operator | string | No | Action target operator (ID) | john_doe |
Group | string | No | Action target group (ID) | support |
<?php
$requestObject = json_decode($_POST["livezilla_user_api_request"]);
$responseObject = array();
$responseObject["Value"] = "";
$responseObject["Id"] = rand(1111111,9999999);
$responseObject["SearchKB"] = false;
if($requestObject->RequestNumber==0 || $requestObject->Value=='list')
{
$responseObject["Select"] = array();
$responseObject["Select"][] = array("title"=>"Enter something","return"=>"something");
$responseObject["Select"][] = array("title"=>"Link (go to website)","url"=>"http://www.livezilla.net","return"=>"");
$responseObject["Select"][] = array("title"=>"Run some Javascript (JS)","script"=>"alert(123);","return"=>"");
$responseObject["Select"][] = array("title"=>"Start a Chat","action"=>"chat","operator"=>"administrator","group"=>"support");
$responseObject["Select"][] = array("title"=>"Leave a Message","action"=>"message","group"=>"support");
$responseObject["Value"] = "Thanks for testing me. Here's a list of options, please click something or type 'list' to reset.";
}
if(!empty($responseObject["Value"]))
echo json_encode($responseObject);
?>
<?php
$requestobj = json_decode($_POST["livezilla_user_api_request"]);
$responseNode = array();
$responseNode["ResponseTo"] = "";
$responseNode["Id"] = rand(1111111,9999999);
$responseNode["SearchKB"] = false;
$url = "http://api.program-o.com/v2/chatbot/?bot_id=6&say=".rawurlencode($requestobj->Value)."&convo_id=".$requestobj->VisitorId."&format=json";
$sdata = json_decode(file_get_contents($url));
$responseNode["Value"] = $sdata->botsay;
if(!empty($responseNode["Value"]))
echo json_encode($responseNode);
?>
<?php
$requestobj = json_decode($_POST["livezilla_user_api_request"]);
$responseNode = array();
$responseNode["Value"] = "";
$responseNode["ResponseTo"] = "";
$responseNode["SearchKB"] = false;
if($requestobj->Value != "[__[EXIT]__]")
{
// first user interaction
if($requestobj->ResponseTo == "")
{
// store initial question
$responseNode["Data"] = array();
$responseNode["Data"]["114"] = $requestobj->Value;
$responseNode["Id"] = "action:request_name";
$responseNode["Value"] = "Ok. What's your name please?";
}
// user defines name
if($requestobj->ResponseTo == "action:request_name")
{
$responseNode["Id"] = "action:request_pizza_type";
$responseNode["Value"] = "Great, nice to meet you <b>" . $requestobj->Value . "</b>.";
$responseNode["Value"] .= "What size do you like your Pizza?<br><br>";
// store name
$responseNode["Data"]["111"] = $requestobj->Value;
$responseNode["Data"] = array();
$responseNode["Select"] = array();
$responseNode["Select"][] = array("title"=>"Medium - 10\" / 25 cm.","return"=>"Medium");
$responseNode["Select"][] = array("title"=>"Italian - 12\" / 30 cm.","return"=>"Italian");
$responseNode["Select"][] = array("title"=>"Large - 14\" / 35 cm.","return"=>"Large");
// block input field
$responseNode["Block"] = true;
}
// user defines pizza style
if($requestobj->ResponseTo == "action:request_pizza_type")
{
$responseNode["Id"] = "action:request_customer_number";
$responseNode["Value"] = "Your Pizza will be " . $requestobj->Value . " style. All saved!";
$responseNode["Value"] .= "Your customer number would be helpful, too. Do you have one?<br><br>";
// store pizza type (represents custom combobox field 0)
$responseNode["Data"] = array();
$responseNode["Data"]["0"] = $requestobj->Value;
$responseNode["Select"] = array();
$responseNode["Select"][] = array("title"=>"Yes","return"=>"Yes");
$responseNode["Select"][] = array("title"=>"No","return"=>"No");
// block input field
$responseNode["Block"] = true;
}
if($requestobj->ResponseTo == "action:request_customer_number")
{
// and so on ...
$responseNode["Value"] = "This demo ends here ...";
$responseNode["Block"] = false;
}
}
else
{
// say good bye
$responseNode["Id"] = "action:end_chat";
$responseNode["Value"] = "Take care, bye!";
}
echo json_encode($responseNode);
?>
API Chat Versão 2
Endpoints e utilização da API relacionada ao Chat Livezilla
General API Information and Usage
This is the documentation for the LiveZilla API V2 included from 5.2.5.x. Please read the contents of this page carefully.
Unlike other (RESTful) APIs, the LiveZilla API is solely based on POST and JSON. We do not make use of GET, PUT, DELETE or custom HEADER calls and statements to ensure highest availability – even on shared hosting platforms with limited configuration options.
LiveZilla V2 API calls must be HTTP POST requests targeting:
http(s)://{yourdomain}/livezilla/api/v2/api.php
Authentication and Security
All API calls must include the POST parameters p_user and p_pass to authenticate against the LiveZilla server.
Any LiveZilla operator login information can be used for API call. Permission for API calls must be granted under:
User Management -> Roles -> Role -> API
For security reasons it’s recommended practice to:
- Use HTTPS for all connections to your server
- Configure your LiveZilla to require HTTPS (Server Configuration -> Security -> Require HTTPS)
- Configure an IP Range for your Operator (API) accounts (User Management -> Operators -> Operator -> Security)
Required Authentication Parameters
These POST parameters must be passed with every API Call.
Name | POST Key | Type | Required | Comment | Example |
---|---|---|---|---|---|
User | p_user | string | Yes | API Authentication User | administrator |
Pass | p_pass | string | Yes | API Authentication Password (md5 encoded) | md5(‘password’) |
Optional Parameters
These optional POST parameters can be passed with every API Call.
Name | POST Key | Type | Required | Comment | Example |
---|---|---|---|---|---|
JSON_Pretty | p_json_pretty | int | No | Activates PHP JSON Pretty Print output | 1 |
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
UserId | string | Yes | No | The alphanumeric login ID of the operators. | john_doe |
Fullname | string | Yes | No | Operators full name. | John Doe |
string | Yes | No | Operators email. | [email protected] | |
Language | string | Yes | No | ISO two letter language code. | EN |
Webspace | int | Yes | No | Webspace in MB operator is allowed to use for file uploads (0=deactivated). | 100 |
Password | string | Yes | No | Operators password (MD5 encoded). | md5(‘johns_password’) |
Groups | array | Yes | No | List of group IDs representing the groups the operators is a member of. | groupid1,groupid2 |
PermissionSet | string | Yes | No | String representing the operators permission set. [0] = TicketPermission Example: 2121202101000210111101111111111111011111011011022101 | |
Description | string | No | No | Description Text | Nice guy |
Level | int | No | No | Defines if operator is server administrator. | 1 |
Status | int | No | Yes | Operator’s current online status (0=Online,1=Busy,2=Offline,3=Away). | 0 |
PictureFile | string | No | Yes | Operator’s Image File, add to full URL. | picture.php?intid… |
ChatFile | string | No | Yes | File to initiate chat with Operator, add to full URL. | chat.php?intid… |
IsBot | boolean | No | Yes | Is bot (or human). | 1 |
ExternalChats | array | No | Yes | List of active (external) chat objects. (LiveZilla 5.4.0.1) | chat1,chat2 |
ExternalChatCount | int | No | Yes | Count of active (external) chats. (LiveZilla 5.4.0.1) | 1 |
| ||||||||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_operators_list"]=1;
$postd["p_json_pretty"]=1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
if(count($response)==0)
exit("No operators found");
foreach($response->Operators as $obj)
{
if($obj->Operator->Status < 2 && !$obj->Operator->IsBot)
{
echo "<img src=\"" . $livezillaURL . $obj->Operator->PictureFile . "\"> ";
echo $obj->Operator->Fullname . " is online ";
echo "<a href=\"" . $livezillaURL . $obj->Operator->ChatFile . "\" >Chat</a><br>";
}
}
?>
|
CURL Example
|
Response
|
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_operator_create"]=1;
$postd["p_json_pretty"]=1;
class Operator
{
public $UserId = 'john_doe';
public $Firstname = 'John';
public $Lastname = 'Doe';
public $Email = '[email protected]';
public $Language = 'EN';
public $Webspace = '100';
public $Password = "";
public $Roles = "f7d450ede1fe1d035689c967f0836dfd";
public $Skills = "purchasing";
public $Location = "usa";
public $Groups = array("support","sales");
}
$newOperator = new Operator();
$newOperator->Password = md5("johnspassword");
$postd["p_data"]= json_encode(array("Operator"=>$newOperator));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>
|
CURL Example
|
Response
|
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_operator_delete"]=1;
$postd["p_json_pretty"]=1;
class Operator
{
public $UserId = 'john_doe';
}
$deleteOperator = new Operator();
$postd["p_data"]= json_encode(array("Operator"=>$deleteOperator));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
ChatId | string | Yes | Yes | The chat ID | 11123 |
TimeStart | int | No | Yes | UNIX Timestamp of chat’s start time | 1395332157 |
TimeEnd | int | No | Yes | UNIX Timestamp of chat’s end time | 1395332206 |
Language | string | No | Yes | Visitor’s langauge (ISO two letter) | EN |
OperatorId | string | No | Yes | Operator’s User Id | john_doe |
VisitorId | string | No | Yes | Visitor’s Id | bd1e10d650 |
Group | string | No | Yes | Group Id | groupid1 |
HTML | string | No | Yes | HTML Chat Transcript | <table width=”97%” border=”0″…. |
PlainText | string | No | Yes | Plain Text Chat Transcript | | 20.03.2014 17:15:59 | Stefa… |
Fullname | string | No | Yes | Visitor’s name | Johanna Doe |
string | No | Yes | Visitor’s email | [email protected] | |
Company | string | No | Yes | Visitor’s company | Jdscompany Ltd. |
Question | string | No | Yes | Visitor’s question | Can you help me? |
Country | string | No | Yes | Visitor’s country | US |
Phone | string | No | Yes | Visitor’s phone # | 004988373728 |
Host | string | No | Yes | Visitor’s host | [email protected] |
IP | string | No | Yes | Visitor’s IP | 192.168.1.222 |
Customs | array<int,array<str, str>> | No | Yes | Custom input field values Read morearray<index,array<input_name, input_value>> |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_chats_list"]=1;
$postd["p_json_pretty"]=1;
// filter parameters to include yesterday's tickets (100 maximum)
$yesterdayBegin = strtotime("yesterday");
$yesterdayEnd = strtotime("today");
$postd["p_start_after"]=$yesterdayBegin;
$postd["p_start_before"]=$yesterdayEnd;
$postd["p_limit"]=100;
$postd["p_output"]="Plaintext";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
if(count($response)==0)
exit("No chats found");
foreach($response->Chats as $obj)
{
echo "New chat: " . $obj->Chat->ChatId;
echo "<br>";
// further processing ...
}
?>
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
Id | int | No | Yes | The serial ticket ID | 11123 |
Group | string | Yes | No | Group Id | groupid1 |
Channel | int | No | No | Channel Read more[0] = Web [1] = Email [2] = Phone [3] = Misc [4] = Chat [5] = Rating | |
SubChannel | string | No | No | Sub-Channel Name | Sub Channel Name |
Language | string | No | No | Ticket’s Langauge (ISO two letter) | EN |
LastUpdated | int | No | Yes | Last updated time (UNIX Timestamp) | 1395332206 |
WaitBegin | int | No | Yes | Wait begin time (UNIX Timestamp) | 1395332157 |
Messages | array<TicketMessage> | No | Yes | Ticket Messages | |
Editor | TicketEditor | No | Yes | Ticket Editor (Operator) |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_tickets_list"]=1;
$postd["p_json_pretty"]=1;
// filter parameters to include yesterday's tickets (100 maximum)
$yesterdayBegin = strtotime("yesterday");
$yesterdayEnd = strtotime("today");
$postd["p_created_after"]=$yesterdayBegin;
$postd["p_created_before"]=$yesterdayEnd;
$postd["p_limit"]=100;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
if(count($response->Tickets) == 0)
exit("No tickets found");
foreach($response->Tickets as $obj)
{
echo "New ticket: " . $obj->Ticket->Id;
echo "<br>";
// further processing ...
}
?>
|
CURL Example
|
Response
|
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_ticket_create"]=1;
$postd["p_json_pretty"]=1;
class Ticket
{
public $Group = "support";
public $CreationType = 0;
public $Language = "en";
public $Messages = array();
}
$newTicket = new Ticket();
$postd["p_data"]= json_encode(array("Ticket"=>$newTicket));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
// Please don't miss to add a message to your ticket.
// Tickets with no messages will not be displayed in the operator client software.
echo $server_output;
curl_close($ch);
?>
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
Id | string | No | Yes | Message ID Read moreFirst message’s ID must be equal to ticket ID. Example: First Message: 11701 Second Message: 246733d03f64db3b72af327d0d835ebd | |
TicketId | string | Yes | No | Ticket ID | 11701 |
Fullname | string | No | No | Visitor’s name | Johanna Doe |
string | No | No | Visitor’s email | [email protected] | |
Company | string | No | No | Visitor’s company | Jdscompany Ltd. |
Phone | string | No | No | Visitor’s phone # | 004988373728 |
IP | string | No | No | Visitor’s IP | 192.168.1.222 |
CallMeBack | boolean | No | Yes | Callback Required | true |
Type | int | No | No | Message Type Read more[0] = (Incoming) Web [1] = (Outgoing) Email [2] = Chat [3] = (Incoming) Email | |
Subject | string | No | No | Subject / URL | Can you help? |
SenderId | string | No | No | Operator or Visitor Id | john_doe |
ChannelId | string | No | No | ||
Comments | array<int,array<str, str>> | No | No | Ticket Comments Read morearray<index,array<operator_id, comment_text>> | |
Attachments | array<Attachment> | No | Yes | File attachments | |
Edited | int | No | Yes | Last edited time (UNIX Timestamp) | 1395332206 |
Created | int | No | Yes | Created (UNIX Timestamp) | 1395332206 |
Customs | array<int,array<str, str>> | No | No | Custom input field values Read morearray<index,array<input_name, input_value>> | |
Text | string | No | No | Message Plaintext | Hello, please help me. |
| ||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_ticketmessage_create"]=1;
$postd["p_json_pretty"]=1;
class TicketMessage
{
public $Fullname = "Johanna Doe";
public $TicketId = 11704;
public $Email = "[email protected]";
public $Phone = "004988373728";
public $Type = 0;
public $Text = "Hello, please help me.";
public $Subject = "http://www.mywebsite.domain/products";
public $IP = "217.2.5.1";
public $Company = "Jdscompany Ltd.";
//public $Customs = array(array("CustomerNumber","11112726"));
//public $Comments = array(array("john_doe","comment #1"),array("john_doe","comment #2"));
}
$newMessage = new TicketMessage();
$postd["p_data"]= json_encode(array("TicketMessage"=>$newMessage));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
Editor | string | Yes | No | Editor (=Operator) ID | john_doe |
Status | int | No | No | Ticket Status Read more[0] = Open [1] = In Progress [2] = Closed [3] = Deleted [4] = Pending | |
SubStatus | string | No | No | Ticket Sub-Status | Sub-Status Name |
Id | string | Yes | No | Ticket ID | 11123 |
|
CURL Example
|
Response
|
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_ticketeditor_assign"]=1;
$postd["p_json_pretty"]=1;
class TicketEditor
{
public $Id = "11967";
public $Editor = "john_doe";
}
$neweditor = new TicketEditor();
$postd["p_data"]= json_encode(array("TicketEditor"=>$neweditor));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>
JSON Key | Type | Required | Read only | Comment | Example |
---|---|---|---|---|---|
Id | string | No | No | Unique ID (32 chars) | 14t733d03f64db3b72af327d0d835ebd |
Tags | string | No | No | Tags (comma separated) | car,sharing,stations |
Value | string | Yes | No | Content (HTML, URL or Filename) | … |
Title | string | Yes | No | Title | Where to find car sharing stations? |
Languages | string | No | No | Languages (comma-separated iso 2 letter code) | de,fr |
Type | int | Yes | No | Resource Type (0=Folder, 1=HTML/Text, 2=Link, 3=Operator File, 4=Customer File) | 0 |
ParentId | string | Yes | No | Parent’s Id (root = 1) | ae33b353c9174c3f97628067f8104405 |
IsPublic | int | No | No | Defines if entry can be found in Knowledgebase | 1 |
FulltextSearch | int | No | No | Defines if fulltext (= content) search will be used | 1 |
ShortcutWord | string | No | No | Shortword for operator client | myshortcut |
GroupId | string | No | No | Group ID (owner) (LiveZilla 6.1.1.0) | support |
OwnerId | string | No | No | Operator ID (owner) (LiveZilla 6.1.1.0) | d351dc9 |
AllowBotAccess | int | Yes | No | Defines if entry will be used by Virtual Assistance | 1 |
| ||||||||||||||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_knowledgebase_entries_list"]=1;
$postd["p_json_pretty"]=1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
if(count($response->KnowledgeBaseEntries) == 0)
exit("No KnowledgeBase entries found");
foreach($response->KnowledgeBaseEntries as $obj)
{
echo "Entry: " . $obj->KnowledgeBaseEntry->Title;
echo "<br>";
// further processing ...
}
?>
|
CURL Example
|
Response
|
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_knowledgebase_entry_create"]=1;
$postd["p_json_pretty"]=1;
class KnowledgeBaseEntry
{
public $Tags = "car, sharing";
public $Value = "Content goes here ....";
public $Title = "Where to find car sharing stations?";
public $ParentId = "ae33b353c9174c3f97628067f8104405";
public $Type= 1;
public $IsPublic = 1;
public $FulltextSearch = 1;
public $ShortcutWord = "myshortcut";
public $AllowBotAccess = 1;
}
$newKBEntry = new KnowledgeBaseEntry();
$postd["p_data"]= json_encode(array("KnowledgeBaseEntry"=>$newKBEntry));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
curl_close($ch);
?>
| ||||||||||||||||||||||||||||||
Filters
| ||||||||||||||||||||||||||||||
CURL Example
| ||||||||||||||||||||||||||||||
Response
| ||||||||||||||||||||||||||||||
Error Codes
|
<?php
$livezillaURL = "http(s)://{yourdomain}/livezilla/";
$apiURL = $livezillaURL . "api/v2/api.php";
// authentication parameters
$postd["p_user"]='{user_id}';
$postd["p_pass"]=md5('{user_password}');
// function parameter
$postd["p_cronjob_execute"]=1;
$postd["p_send_chat_transcripts"]=1;
$postd["p_receive_emails"]=1;
$postd["p_maintenance"]=1;
$postd["p_social_media"]=1;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$apiURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postd));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
if($server_output === false)
exit(curl_error($ch));
echo $server_output;
echo "<hr>";
curl_close($ch);
$response = json_decode($server_output);
?>