Constructor
new ChatixCore(chat)
- Source:
Properties:
Parameters:
| Name | Type | Description |
|---|---|---|
chat |
Chat | Internal class that does all dirty work. Please ignore this class because all Chatix public methods are in this class. We can't guarantee that structure and behavior will not change in future. Use stable public API instead. Thank you! |
Methods
(async) connectToChatroom(chatroomId)
- Source:
Connects visitor to chatrooms
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom's ID that visitor should connect to |
(async) disconnectFromChatroom(chatroomId)
- Source:
Disconnects visitor from chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom's ID that should disconnect from |
(async) getAllChatrooms(page, perPage)
- Source:
Gets all (avaliable for visitor) chatrooms. There will be public chatrooms and private, where visitor is connected.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
page |
number |
1
|
Current page number (starting at 1) |
perPage |
number |
100
|
Number of items per one page |
(async) getAllManagers()
- Source:
Gets all managers of webchat
(async) getChatroom(chatroomId)
- Source:
Gets chatroom from API
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom ID |
(async) getChatroomMembers(chatroomId, page, perPage)
- Source:
Gets members of chatroom
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
chatroomId |
string | Chatroom ID |
|
page |
* |
1
|
number of page |
perPage |
* |
50
|
number of items per page |
(async) getChatroomMessages(chatroomId, lastMess, count)
- Source:
Gets messages of chatroom with ID chatroomId before lastMess (or last if it is NULL) in number of amount
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
chatroomId |
string | chatroom ID |
|
lastMess |
string |
null
|
last known message id |
count |
number |
50
|
number of messages to receive |
(async) getConnectedManagers()
- Source:
Gets all connected managers to current user conversation
(async) getConversationMessages(lastMess, count)
- Source:
Gets messages of visitor's conversation before lastMess (or last if it is NULL) in number of amount
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
lastMess |
string |
null
|
last known message id |
count |
number |
50
|
number of messages to receive |
getMinutesToWork() → {number}
- Source:
- To Do:
-
- Обработать правильную отдачу -1 и 0.
Calculates number of minututes to next workink day
Returns:
X minutes to next workday. NULL if no working days specified in schedule, 0 - if it is working hour now
- Type
- number
(async) getMyChatrooms(page, perPage)
- Source:
Gets all chatrooms where visitor is connected.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
page |
number |
1
|
Current page number (starting at 1) |
perPage |
number |
100
|
Number of items per one page |
getVisitor() → {Visitor}
- Source:
Getting current visitor details
Returns:
- Type
- Visitor
(async) getWebChat()
- Source:
Gets webchat information such as schedule
(async) interruptScreencast()
- Source:
Manually stops screencast
(async) sendChatroomFileMessage(file, chatroomId)
- Source:
Send file message in chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
file |
File | File to send. If file is JPEG/PNG file, it will be saved as image message, otherwise - file message. File can be up to 20Mb. |
chatroomId |
string | Chatroom ID where to send message |
(async) sendChatroomTextMessage(messageText, chatroomId)
- Source:
Send text message in chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
messageText |
string | text to send in chatroom |
chatroomId |
string | Chatroom ID where to send message |
(async) sendConversationFileMessage(file)
- Source:
Send file message in conversation
Parameters:
| Name | Type | Description |
|---|---|---|
file |
File | File to send. If file is JPEG/PNG file, it will be saved as image message, otherwise - file message. File can be up to 20Mb. |
(async) sendConversationTextMessage(messageText)
- Source:
Send text message in conversation
Parameters:
| Name | Type | Description |
|---|---|---|
messageText |
string | text to send in conversation |
(async) sendScreencastPermission(flag)
- Source:
Sends visitor's answer for requesting screencast permission
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
boolean | User's decision. TRUE - allow screencast, FALSE = disallow. |
(async) setEmail(email)
- Source:
Sets current visitor's email
Parameters:
| Name | Type | Description |
|---|---|---|
email |
string | Visitor's email to set |
(async) setField(key, value)
- Source:
Sets visitor's field by key and value
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | field key |
value |
string | number | boolean |
(async) setName(name)
- Source:
Sets current visitor's name
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Visitor's name to set |
(async) setVisitor(visitor)
- Source:
Sets current visitor object
Parameters:
| Name | Type | Description |
|---|---|---|
visitor |
Visitor |
(async) start()
- Source:
Starts connection. This method is required for launch connection.
(async) stop()
- Source:
Manually stops connection
(async) visitorType(text)
- Source:
Sends typed, but have not sent yet text message.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Text content of visitor's message field |