LiveZilla Live Chat
EN  DE Please sign in or register Hi
We use LiveZilla since 2008 and highly recommend it to everyone. Almost six years, not a single problem...
Bendler Cars And Tires
Show all reviews


LiveZilla API V2




TicketMessage
TicketMessage Object Format
TicketMessage is represented as JSON objects having the following keys:


JSON Key Type Required Read only Comment Example
IdstringNoYes
Message ID

First message's ID must be equal to ticket ID.

Example:
First Message: 11701
Second Message: 246733d03f64db3b72af327d0d835ebd
Read more
TicketIdstringYesNoTicket ID11701
FullnamestringNoNoVisitor's nameJohanna Doe
EmailstringNoNoVisitor's emailjohanna@jdscompany.com
CompanystringNoNoVisitor's companyJdscompany Ltd.
PhonestringNoNoVisitor's phone #004988373728
IPstringNoNoVisitor's IP192.168.1.222
CallMeBackbooleanNoYesCallback Requiredtrue
TypeintNoNo
Message Type

[0] = (Incoming) Web
[1] = (Outgoing) Email
[2] = Chat
[3] = (Incoming) Email
Read more
SubjectstringNoNoSubject / URLCan you help?
SenderIdstringNoNoOperator or Visitor Idjohn_doe
ChannelIdstringNoNo
Commentsarray<int,array<str, str>>NoNo
Ticket Comments

array<index,array<operator_id, comment_text>>
Read more
Attachmentsarray<Attachment>NoYesFile attachments
EditedintNoYesLast edited time (UNIX Timestamp)1395332206
CreatedintNoYesCreated (UNIX Timestamp)1395332206
Customsarray<int,array<str, str>>NoNo
Custom input field values

array<index,array<input_name, input_value>>
Read more
TextstringNoNoMessage PlaintextHello, please help me.


TicketMessage Functions


Create Ticket Message
Function
As of version 5.2.5.0


POST /api/v2/api.php p_ticketmessage_create=1


Filters


Name POST Key Type Required Comment Example  
SendEmailResponderp_sendemailresponderboolNoSend autoresponder email to sender of message1
SendEmailReplyp_sendemailreplyboolNoSend operator reply email to receiver of message1
QuoteMessageIdp_quotemessageidstringNoThe Ticket Message ID of the Message the Operator is replying to.90f9cf...


CURL Example


curl {yourdomain}{livezilla_folder}/api/v2/api.php
-d {authenthication}
-d p_ticketmessage_create=1
-d p_data={ "TicketMessage": { "Type": "0", "Customs": "", "ChannelId": "", "Subject": "Can you help?", "Comments": "", "TicketId": "11701", "Text": "Hello, please help me.", "Fullname": "Johanna Doe", "Company": "Jdscompany Ltd.", "Phone": "004988373728", "Email": "johanna@jdscompany.com", "IP": "192.168.1.222", "SenderId": "john_doe" } } -X POST

Response


200 Ok: {
    "TicketMessage": {
        "Type": "0",
        "Customs": "",
        "CallMeBack": "true",
        "ChannelId": "",
        "Attachments": "",
        "Edited": "1395332206",
        "Subject": "Can you help?",
        "Comments": "",
        "TicketId": "11701",
        "Text": "Hello, please help me.",
        "Created": "1395332206",
        "Id": "
First Message: 11701
Second Message: 246733d03f64db3b72af327d0d835ebd", "Fullname": "Johanna Doe", "Company": "Jdscompany Ltd.", "Phone": "004988373728", "Email": "johanna@jdscompany.com", "IP": "192.168.1.222", "SenderId": "john_doe" } }

Error Codes


                            403 Forbidden: Invalid or no user authentication data sent (see General API Authentication)
400 Bad Data: Invalid or missing POST parameters (see required fields/filters and data types)
                        


Example: PHP code to add a message to an existing ticket


    <?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 = "johanna@jdscompany.com";
                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);
    ?>





Something missing?


If you find anything missing please let us know and we will add the missing structures right away. Thanks.