.getChats()
This API is used to get a list of all the chats had by a visitor along with the details of each chat. It returns an array of VisitorChat objects.
Callbacks:
| Name | Description |
| error | Error is returned if an error occurs while using the API. The list of possible error codes returned by the API are listed below. |
| chats | List of chats |
​Error Codes:
| Code | Message |
| 500 | mobilisten not initialised |
| 605 | mobilisten disabled |
| 600 | no network connection |
| 609 | salesiq api exception |
Chat map contains the following properties:
| Property | Datatype | Description |
| id | String | The ID of the chat |
| question | String | The question with which the chat was initiated |
| attenderName | String | Name of the chat attender |
| attenderEmail | String | Email of the chat attender |
| attenderID | String | The ID of the chat attender |
| departmentName | String | Name of the department to which the chat is associated |
| feedback | String | Feedback provided for the chat |
| lastMessage (Deprecated) | String | Last message in the chat |
| status | SIQChatStatus | The status of the chat |
| rating | String | Rating given for the chat |
| unreadCount | int | Unread message count for the chat |
| isBotAttender | bool | Flag to check if the last chat was attended by a bot |
| lastMessageSender (Deprecated) | String | Name of the last message sender |
| lastMessageTime (Deprecated) | long | Time of the last message in the chat |
| queuePosition | int | Position of the chat in current queue |
| recentMessage | Map | It contains the last message's content and its metadata. |
RecentMessage:
The RecentMessage object contains the last message's content and its metadata.
| Property | Data type | Description |
| time | long | Time of the last message sent in chat |
| text | String | Last message text in the chat |
| sender | String | Name of the sender of the last message |
| isRead | boolean | To check if the last message was read. |
| file | Map | This property will return the details of the file. |
File:
If the last message is a file, this property provides details of the file.
| Property | Data type | Description |
| name | String | File name of the last message |
| size | int | File size of the last message |
| contentType | String | File MIME type of the last message (Ex: image/jpeg, video/mp4, audio/mp3, etc..) |
| comment | String | File comment of the last message |
Syntax
CopiedZohoSalesIQ.getChats(callback: (error: CallbackError, chats: SalesIQChat[] | null) => void)Example:
CopiedZohoSalesIQ.getChats( (error, chats) =>
{
//your code
});