Chat history
Posted on Mar 04, 2016 16:56
With this API call you can get your Chat history.
JSON Format
Each Chat history is represented as JSON object with the following properties:
Name |
Type |
Description |
AgentId |
number |
The id of the agent. Can be null if no agent answered the chat |
AgentName |
string |
The name of the agent |
Visitor |
object |
The visitor |
Date |
string |
The date of the chat |
Messages |
array |
The messages |
Vote |
string |
Can be "Good" or "Bad" |
Get All Chat histories
GET /api/chats?page=1
Get all chat histories for your account. You have to provide the ?page= parameter and specify the number of the page.
Example response
{
"Data": [
{
"AgentId": 150,
"AgentName": "Jason",
"Visitor": {
"Name": "Emma",
"Email": "emma@myemail.com",
"Phone": "555-555-5555"
},
"Date": "2016-03-08T19:19:10.677Z",
"Messages": [
{
"Username": "Emma",
"Message": "Do you have a Free plan?",
"Date": "2016-03-09T19:18:00Z"
},
{
"Username": "Jason",
"Message": "Of course. Our Free plan includes 150 chats per month.",
"Date": "2016-03-09T19:18:45Z"
},
{
"Username": "Emma",
"Message": "Great. I will give it a try :)",
"Date": "2016-03-09T19:18:57Z"
}
],
"Vote": "Good"
},
{
"AgentId": 151,
"AgentName": "Kate",
"Visitor": {
"Name": "Mark",
"Email": "mark@myemail.com",
"Phone": null
},
"Date": "2016-03-08T19:15:52.703Z",
"Messages": [
{
"Username": "Mark",
"Message": "Hi, I have a question.",
"Date": "2016-03-09T18:56:39Z"
},
{
"Username": "Kate",
"Message": "Hi there, how can I help you?",
"Date": "2016-03-09T18:56:52Z"
}
],
"Vote": null
}
................................................
],
"Paging": {
"PageNo": 1,
"PageSize": 20,
"PageCount": 10,
"TotalRecordCount": 200
}
}
|
Get Chat history by agent and by date
GET /api/chats?page=1&agent={agent_email}&fromDate={from_date}&toDate={to_date}&type=0
Get chat histories from your account by specified agent's email. You have to provide the ?page= parameter and specify the number of the page. You can add optional parameters &agent= and specify agent's email, &fromDate= and &toDate=, &type= with value 0 (chats) or 1 (missed chats).
Example response
{
"Data": [
{
"AgentId": 150,
"AgentName": "Jason",
"Visitor": {
"Name": "Emma",
"Email": "emma@myemail.com",
"Phone": "555-555-5555"
},
"Date": "2016-03-08T19:19:10.677Z",
"Messages": [
{
"Username": "Emma",
"Message": "Do you have a Free plan?",
"Date": "2016-03-09T19:18:00Z"
},
{
"Username": "Jason",
"Message": "Of course. Our Free plan includes 150 chats per month.",
"Date": "2016-03-09T19:18:45Z"
},
{
"Username": "Emma",
"Message": "Great. I will give it a try :)",
"Date": "2016-03-09T19:18:57Z"
}
],
"Vote": "Good"
},
],
"Paging": {
"PageNo": 1,
"PageSize": 20,
"PageCount": 1,
"TotalRecordCount": 1
}
}
|