Namespace: moxtra

moxtra

Source:

Methods

(static) canAddUserInChat(callback)

Set the callback when add user button in chat needs show/hide
Parameters:
Name Type Description
callback function Would be invoked only when all pre-conditions satisfied. For example, the chat must be a group chat and current user has privilege to invite new member. And this callback MUST return a boolea value. Parameter like below: { "chat_id": id of the chat where add user button in }
Source:

(static) destroyMEPWindow()

Destroy the MEP window.
Source:

(static) getLastActiveTimestamp(success, failure)

Get current user's last active timestamp
Parameters:
Name Type Description
success function Callback invoked when get succeed, with an unix timestamp in milliseconds
failure function Callback invoked when get failed, with parameter like below: { "error_code":3 //error code "error_message": 'sdk not initialized' //Detail error message }
Source:

(static) getUnreadMessageCount(success, failure)

Get current user's unread messages count
Parameters:
Name Type Description
success function Callback invoked when get succeed, with an integer parameter which represents current unread messages count
failure function Callback invoked when get failed, with parameter like below: { "error_code":3 //error code "error_message": 'sdk not initialized' //Detail error message }
Source:

(static) getUnreadMessageCountWithOption(options, success, failure)

Listen current user's unread messages per type.
Parameters:
Name Type Description
options object Additional options when get unread count message. Supported key-values list below: { "type": 5 //Which type of chat you intend to filter, 5 represents live chat, 6 represents service request. }
success function Callback invoked when get succeed, with an integer parameter which represents corresponding unread messages count
failure function Callback invoked when get failed, with parameter like below: { "error_code":3 //error code "error_message": 'sdk not initialized' //Detail error message }
Source:

(static) hideMEPWindow()

Hide MEP window
Source:

(static) isLinked(callback)

Request MEP link state.
Parameters:
Name Type Description
callback function Callback that returns the MEP is linked or not, includes a boolean parameter.
Source:

(static) isMEPNotification(notificationPayload, callback)

Verify notification is from MEP or not.
Parameters:
Name Type Description
notificationPayload string The notification payload with json string format.
callback function Callback that returns the notification is from mep or not, includes a boolean parameter.
Source:

(static) joinMeet(sessionId, success, failure)

Join a scheduled meeting as participant or start scheduled meeting as host.
Parameters:
Name Type Description
sessionId string The meeting's session id, required.
success function Callback invoked when join succeed.
failure function Callback invoked when join failed, with parameter like below: { "error_code":5 //error code "error_message": 'object not found' //Detail error message }
Source:

(static) joinMeetAnonymously(sessionId, options, success, failure)

Join a meeting anonymously.
Parameters:
Name Type Description
sessionId string The meeting's session id, required.
options object Additional options when join a meeting anonymously. If currently there is a logged in user, options will be ignored. Supported key-values list below: { "display_name": "Kate Bell" //String value, as your name when join meeting , optional. "email": "katebell@moxo.com" //String value, as your email when join meeting , optional. }
success function Callback invoked when join succeed.
failure function Callback invoked when join failed, with parameter like below: { "error_code":5 //error code "error_message": 'object not found' //Detail error message }
Source:

(static) linkWithAccessToken(accessToken, success, failure)

Link MEP account with the access token.
Parameters:
Name Type Description
accessToken string MEP login credential.
success function Callback invoked when link succeed.
failure function Callback invoked when link failed, with parameter like below: { "error_code":0 //error code "error_message": 'No network' //Detail error message }
Source:

(static) makeDivInteractive(div)

Make web element interactive when it is showing on MEP window
Parameters:
Name Type Description
div HTMLDivElement The element which needs to be interactive
Source:

(static) makeDivNoninteractive()

Make web element noninteractive when it will be hidden or removed from MEP window. IMPORTANT: This method is required to be triggered as a pair with makeDivInteractive, otherwise touch event on screen will be unpredictable.
Source:

(static) onAddMemberInChatClicked(callback)

Set the callback when user clicked the add member button inside the chat.
Parameters:
Name Type Description
callback function Would be invoked when user clicked the add button, with parameter like below: { "chat_id": id of the chat where call button clicked }
Source:

(static) onCallButtonClicked(callback)

Set the callback when user clicked the call button from timeline、calendar or chat
Parameters:
Name Type Description
callback function Would be invoked when user clicked any call button from timeline、calendar or chat, with parameter like below: { "chat_id": id of the chat where call button clicked if is triggered from chat page "unique_ids": An array which includes all chat member's unique_id if is triggered from chat page }
Source:

(static) onCloseButtonClicked(callback)

Set the callback when user clicked the close button on top left of MEP window. If not set, sdk will do nothing.
Parameters:
Name Type Description
callback function Would be invoked when user clicked the close button.
Source:

(static) onInviteButtonInLiveMeetClicked(callback)

Set the callback when user clicked the invite button in live meet. If not set, the invite button will not show in live meet.
Parameters:
Name Type Description
callback function Would be invoked when user clicked any invite button in live meet, with parameter like below: { "session_id": id of the meeting. }
Source:

(static) onJoinMeetButtonClicked(callback)

Set the callback when user clicked the join meeting button from timeline、calendar、 chat or ringer page
Parameters:
Name Type Description
callback function Would be invoked when user clicked any join meeting button from timeline、calendar chat、or ringer page, with parameter like below: { "session_id": id of the meeting which user intend to join }
Source:

(static) onLogout(callback)

Set the callback when user log out. Log out manually or kicked out by server, both cases will trigger the callback.
Parameters:
Name Type Description
callback function Would be invoked when user get logout.
Source:

(static) onMeetEditButtonClicked(callback)

Set the callback when user clicked the edit button of meeting
Parameters:
Name Type Description
callback function Would be invoked when user clicked edit button of specific meeting, with parameter like below: { "session_id": id of the meeting which user intend to view }
Source:

(static) onMeetViewButtonClicked(callback)

Set the callback when user clicked the view button of meeting
Parameters:
Name Type Description
callback function Would be invoked when user clicked view button of specific meeting, with parameter like below: { "session_id": id of the meeting which user intend to view }
Source:

(static) onUnreadMessageCountUpdated(callback)

Set the callback when unread messages count updated
Parameters:
Name Type Description
callback function Would be invoked when user unread messages count updated, with an integer parameter which represents unread messages count post update
Source:

(static) openChat(chatID, feedSequence, success, failure)

Open chat with chat ID and scroll to the specified feed if present.
Parameters:
Name Type Description
chatID string The chat to open.
feedSequence string The sequence of the scrolling target feed.
success function Callback invoked when open succeed.
failure function Callback invoked when open failed, with parameter like below: { "error_code":4 //error code "error_message": 'no network' //Detail error message }
Source:

(static) openLiveChat(reserved, success, failure)

Show client live chat page Note: This function only works for client user since internal user doesn't have live chat.
Parameters:
Name Type Description
reserved options Reserved parameter, you could pass null for now.
success function Callback invoked when show succeed
failure function Callback invoked when show failed, with parameter like below: { "error_code":4 //error code "error_message": 'no network' //Detail error message }
Source:

(static) openServiceRequest(success, failure)

Show client service reqeusts page Note: This function only works for client user since internal user doesn't have service reqeusts.
Parameters:
Name Type Description
success function Callback invoked when show succeed
failure function Callback invoked when show failed, with parameter like below: { "error_code":4 //error code "error_message": 'no network' //Detail error message }
Source:

(static) parseRemoteNotification(notificationPayload, success, failure)

Parse the notification to extract related info.
Parameters:
Name Type Description
notificationPayload string The notification payload in json string format.
success function Callback invoked when parsing succeed, with parameter like below: { //For chat: "chat_id": "CBPErkesrtOeFfURA6gusJAD" "feed_sequence": 191 //For meet: "session_id": "255576178" }
failure function Callback invoked when parsing failed, with parameter like below: { "error_code": 0 "error_message": "No network" //Detail error message }
Source:

(static) registerNotification(deviceToken)

Register your device token for push notification
Parameters:
Name Type Description
deviceToken string The device token.
Source:

(static) scheduleMeet(topic, uniqueIds, chatId, options, success, failure)

Start a meet with specific topic and members. Meeting screen will show up once meeting started succeed
Parameters:
Name Type Description
topic string The meeting's topic, required
uniqueIds array Unique id array of meeting members you intended to invite,optional
chatId string Id of the chat where you want to place meeting related messages,optional.
options object Additional options when schedule a meeting. Supported key-values list below: { "start_time": "1584693257208" //String value, planning meeting start time, required. "end_time": "1584693557208" //String value, Planning meeting end time, required. }
success function Callback invoked when start succeed, with parameter like below: { "session_id":"745831" //meeting session id }
failure function Callback invoked when schedule failed, with parameter like below: { "error_code":4 //error code "error_message": 'no network' //Detail error message }
Source:

(static) setFeatureConfig(featureConfig)

Set the feature configuration.
Parameters:
Name Type Description
featureConfig Object The feature configuration. Below are the json key/default value/description list: json key default value description voice_message_enabled true Enable/Disable voice message feature. Default is enabled.
Source:

(static) setupDomain(baseDomain, certOrgName, certPublicKey, ignoreBadCert)

Setup domain Notice: This API MUST be invoked first before 'link'
Parameters:
Name Type Description
baseDomain string Your server domain
certOrgName string SSL cert organization name. Optional, default is null.
certPublicKey string SSL cert public key. Optional, default is null. certPublicKey sample: "-----BEGIN PUBLIC KEY-----\n YOUR PUBLIC KEY \n-----END PUBLIC KEY-----\n"
ignoreBadCert boolean Ignore bad SSL cert or not. Default is true.
Source:

(static) showClientDashboardInDiv(div)

Show client dashboard window in a specific web element This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled Note: This function only works for client user since internal user doesn't have dashboard.
Parameters:
Name Type Description
div HTMLDivElement The element where you want to embed MEP window, required to be transparent.
Source:

(static) showLiveChatInDiv(div)

Show live chat list page in a specific web element This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled
Parameters:
Name Type Description
div HTMLDivElement The element where you want to embed live chat listpage, required to be transparent.
Source:

(static) showMEPWindow()

Show a MEP window Display MEP on top of your screen, it includes four tabs: Conversations, Contacts, Calendar, Settings This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled
Source:

(static) showMEPWindowInDiv(div)

Show MEP window in a specific web element This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled
Parameters:
Name Type Description
div HTMLDivElement The element where you want to embed MEP window, required to be transparent.
Source:

(static) showMEPWindowLite()

Show a lite MEP window A lite MEP window only includes: Conversations This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled
Source:

(static) showServiceRequestInDiv(div)

Show service request page in a specific web element This function will use existing window instance if has one, that means page won't reflect setting changes, eg.voice_message_enabled
Parameters:
Name Type Description
div HTMLDivElement The element where you want to embed service request page, required to be transparent.
Source:

(static) startMeet(topic, uniqueIds, chatId, options, success, failure)

Start a meet with specific topic and members. Meeting screen will show up once meeting started succeed
Parameters:
Name Type Description
topic string The meeting's topic, required
uniqueIds array Unique id array of meeting members you intended to invite,optional.
chatId string Id of the chat where you want to place meeting related messages,
options object Additional options when start a meeting, optional. Supported key-values list below: { "auto_join_audio": true, //Boolean value, to join audio automaticaly or not, default is true. "auto_start_video": true //Boolean value, to start video automaticaly or not, default is false. }
success function Callback invoked when start succeed, with parameter like below: { "session_id":"745831" //meeting session id }
failure function Callback invoked when start failed, with parameter like below: { "error_code":4 //error code "error_message": 'no network' //Detail error message }
Source:

(static) switchMainPage(show)

For android only: switch main activity between other activities.
Parameters:
Name Type Description
show boolean true to show main activity, and false to move main activity to background.
Source:
Unlink the account from the MEP service.
Source: