Get list of chats
Returns all ended chats.
Optional parameters:
date_from – YYYY-MM-DD. Defaults to the beginning of time.
date_to – YYYY-MM-DD. Defaults to today.
type – type of chats, not set by default. Available values: chat, missed_chat.
page – page number, defaults to 1.
visitor_id – return chats with specified visitor_id.
query – return chats containing the query.
agent – return chats for given agent login.
group – return chats for given group.
goal – return chats for given goal id.
has_goal – 1/0. If 1 is passed, returns chats having any goal.
rate – filter chats considering its rating status. Available values: rated, not_rated, rated_good, rated_bad.
Additional info:
goal parameter will appear only if a goal for a particular chat has been reached.
custom_variables parameter will be available only if the custom variables are defined in the tracking code.
integration_variables parameter will appear only if a visitor logs in with Facebook.
Results are divided into pages, each containing 25 chats.
total tells you the total number of chats.
pages tells you the total number of pages.
To access next pages of the results, use ?page=<PAGE> parameter.
Please note that first page's number is 1, not 0.
Path
GET https://api.livechatinc.com/chats
Example request
curl -u john.doe@mycompany.com:c14b85863755158d7aa5cc4ba17f61cb -H X-API-Version:2 https://api.livechatinc.com/chats?date_from=2013-01-23&has_goal=1
Example response
{
"chats": [
{
"type": "chat",
"id": "MH022RD0K5",
"visitor_name": "Mary Brown",
"visitor_id": "S1355415390.49b8940793",
"agents": [
{
"display_name": "John Doe",
"email": "john.doe@mycompany.com"
}
],
"supervisors": [
{
"display_name": "Jane Doe",
"email": "jane.doe@mycompany.com"
}
],
"rate": "not_rated",
"duration": 1456, // in seconds
"group": [
0
],
"started": "Wed, 01/23/13 11:40:53 am",
"prechat_survey": [
{
"key": "Name:",
"value": "",
"id": "13589376348060238"
},
{
"key": "E-mail:",
"value": "",
"id": "135893763480606511"
}
],
"custom_variables": [
{
"key": "customer_login",
"value": "mary_brown"
}
],
"integration_variables": [
{
"key": "facebook.id",
"value": "123456789"
},
{
"key": "facebook.name",
"value": "Mary Brown"
},
{
"key": "facebook.first_name",
"value": "Mary"
},
{
"key": "facebook.last_name",
"value": "Brown"
},
{
"key": "facebook.gender",
"value": "female"
},
{
"key": "facebook.locale",
"value": "en_US"
},
{
"key": "facebook.link",
"value": "http://www.facebook.com/mary.brown"
},
{
"key": "facebook.username",
"value": "mary.brown"
},
{
"key": "facebook.email",
"value": "mary.brown@email.com"
}
],
"goals": [
{
"id": 71,
"name": "goal_name"
}
],
"messages": [
{
"author_name": "John Doe",
"text": "Hello",
"date": "Wed, 01/23/13 11:40:53 am",
"timestamp": 1358937653,
"user_type": "agent",
"agent_id": "john.doe@mycompany.com"
},
{
"author_name": "Mary Brown",
"text": "How are you?",
"date": "Wed, 01/23/13 11:41:01 am",
"timestamp": 1358937661,
"user_type": "visitor"
},
{
"author_name": "John Doe",
"text": "Thanks, fine :)",
"date": "Wed, 01/23/13 11:41:05 am",
"timestamp": 1358937665,
"user_type": "agent",
"agent_id": "john.doe@mycompany.com"
},
{
"author_name": "Jane Doe",
"text": "Message from supervisor.",
"date": "Wed, 01/23/13 11:57:13 am",
"timestamp": 1358938633,
"user_type": "supervisor",
"agent_id": "jane.doe@mycompany.com"
}
],
"started_timestamp": 1358937653,
"ended_timestamp": 1358939109,
"ended": "Wed, 01/23/13 12:05:09 pm"
},
{
...
}
],
"total": 2,
"pages": 1
}