This method returns all messages from the chat history based on the provided parameters.
URL
https://api.plupper.com/resources/message
Formats
json
HTTP Method
GET
Requires Authentication
HTTP BASIC
API rate limited
No
Parameters
from:Optional - List only those messages which were sent on or after the selected date. Format:MM/DD/YYto:Optional - List only those messages which were sent on or before the selected date. Format:MM/DD/YYoperator:Optional ? List only those messages which were sent or received by the operator. Operator is identified by the ?operator username?. This parameter is case sensitive.visitorId:Optional ? List only those messages which were sent or received by the visitor. Visitor is identified by the ?ID?.customerId:Optional ? List only those messages which were sent or received by the customer. Customer is identified by the ?ID? (this ?ID? is not unique and may be shared among visitors).contains:Optional ? List only those messages containing the provided text. This parameter is case insensitive.
Response
["{\"content\":\"Plupper: visitor has entered communication\",\"customerId\":null,\"created\":\"Wed Apr 29 17:16:03 CEST 2009\",\"visitorId\":32751,\"type\":\"VO\",\"operator\":\"john\"}",
"{\"content\":\"Hi\",\"customerId\":null,\"created\":\"Wed Apr 29 17:16:13 CEST 2009\",\"visitorId\":32751,\"type\":\"VO\",\"operator\":\"john\"}",
"{\"content\":\"Hi, how can i help you ?\",\"customerId\":null,\"created\":\"Wed Apr 29 17:17:44 CEST 2009\",\"visitorId\":32751,\"type\":\"VT\",\"operator\":\"john\"}",
"{\"content\":\"Can i replace the cat button with my own graphis ?\",\"customerId\":null,\"created\":\"Thu Apr 30 15:54:16 CEST 2009\",\"visitorId\":32751,\"type\":\"VO\",\"operator\":\"john\"}",
"{\"content\":\"Sure, just go to the account settings ...\",\"customerId\":null,\"created\":\"Thu Apr 30 15:57:41 CEST 2009\",\"visitorId\":32751,\"type\":\"VT\",\"operator\":\"john\"}"]
Example queries
- Find all messages from customer named 'IBM' https://api.plupper.com/resources/message?customerId=IBM
- Find all messages from operator "peter" https://api.plupper.com/resources/message?operator=peter
- Find all messages from operator "peter" which contains text "money" https://api.plupper.com/resources/message?operator=peter&contains=money
-
jQuery example
//get all from peter $.ajax({ type: "GET", url: "https://api.plupper.com/resources/message?operator=peter", username: "john.lennon@example.com", password: "mysecret", dataType: "json", success: function(data) { for(var i in data) { var json = eval('(' + data[i] + ')'); alert("message text: " + json.content); } } }); //get single $.ajax({ type: "GET", url: "https://api.plupper.com/resources/message/" + messageId, username: "john.lennon@example.com", password: "mysecret", dataType: "json", success: function(json) { alert("message text: " + json.content); } });