logo
In-app Chat
On this page

Class

2026-01-23
ZIMZPNs

ZIM

Details

ZIM SDK main class.

Methods

create

static
create
deprecated
create(appID: number): ZIM | null
Create a ZIM instance.

Parameters

NameTypeDescription
appIDnumberApplication ID issued by ZEGO for developers, please contact ZEGO technical support to apply.
  • Platform differences: When calling this function under the Android platform, in addition to the appID, the Application class object must also be passed in.
Deprecated
This function is deprecated in version 2.3.0, please use another method with the same name [create]

Return

ZIM instance.

create

static
create
create(appConfig: ZIMAppConfig): ZIM | null
Create a ZIM instance.

Parameters

NameTypeDescription
appConfigZIMAppConfigAppID and appSign issued by ZEGO for developers, Please apply at the ZEGO console.
  • When to call: Before calling other member functions, you must call this API to create a ZIM example.

Usage restrictions: Currently only one instance is supported, repeated calls will return [null].

Precautions:

  1. Currently, the [create] function can only create one instance at most. If it is called multiple times, only the first one will return a valid instance, and the rest will be [null]. The developer should save the ZIM instance by himself, and ensure that the life cycle of the instance is available in the process of using the ZIM business function; or after calling [create], he can use [getInstance] to obtain its singleton object and call other member functions.

  2. If you use this function to create an instance, you must pass in both AppID and AppSign (exclude Web platform).

Scope of Impact: Failure to call this function will prevent other member functions from being called.

Platform difference: When calling this function on the Android platform, in addition to the appID, the Application class object must also be passed in.

Return

ZIM instance.

getVersion

static
getVersion
getVersion(): string
Gets the SDK's version number.

Get the SDK version.

  • Use cases: 1. When the SDK is running, the developer finds that it does not match the expected situation and submits the problem and related logs to the ZEGO technical staff for locating. The ZEGO technical staff may need the information of the engine version to assist in locating the problem.
  1. Developers can also collect this information as the version information of the engine used by the app, so that the SDK corresponding to each version of the app on the line.

When to call : It can be called at any time.

  • Available since: 1.1.0.

SDK version.

getInstance

static
getInstance
getInstance(): ZIM
Get the ZIM singleton object.
  • When to call: You must call [create] to create an instance before calling this function to obtain a singleton object, otherwise it will return [null].

Related interface: [create].

setGeofencingConfig

static
setGeofencingConfig
setGeofencingConfig(areaList: number[], type: ZIMGeofencingType): boolean
Set geofence-related configurations.

Parameters

NameTypeDescription
areaListnumber[]List of geo-fenced areas. Set at least 1 area, and the maximum number of settings cannot be greater than the number supported by the SDK.
typeZIMGeofencingTypeType of geo-fenced area.

Details

Geofencing means that instant messaging data transmission is limited to a certain area to meet regional data privacy and security regulations, that is, to restrict access to communication services in a specific area.

  • When to call /Trigger: The [setGeofencingConfig] interface needs to be called before the [create] interface.
  • Caution: If you need to update geo fencing information, please call the [destroy] interface to destroy the current ZIM instance, and then call this interface.
  • Available since: 2.12.0 and above.
  • Restrictions: If you need to use this function, please contact ZEGO technical support.

Return

Geofencing setup results.

addFriend

addFriend
addFriend(userID: string, config: ZIMFriendAddConfig): Promise<ZIMFriendAddedResult>
Add friends directly.

Parameters

NameTypeDescription
userIDstringuser ID.
configZIMFriendAddConfigAdd a friend related Configuration.

Details

Through this interface, a user with the specified userID can be added to the friend list.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [friendListChanged].
  • Available since: 2.14.0 or above.

Return

Add a friend result callback.

sendFriendApplication

sendFriendApplication
sendFriendApplication(userID: string, config: ZIMFriendApplicationSendConfig): Promise<ZIMFriendApplicationSentResult>
Send a friend application.

Parameters

NameTypeDescription
userIDstringuser ID.
configZIMFriendApplicationSendConfigSend friend application for related configuration.
  • When to call: It can be called after creating a ZIM instance through [create].
  • Related callbacks: [friendApplicationListChanged].

Return

Send friend application result callback.

deleteFriends

deleteFriends
deleteFriends(userIDs: string[], config: ZIMFriendDeleteConfig): Promise<ZIMFriendsDeletedResult>
Delete friends.

Parameters

NameTypeDescription
userIDsstring[]List of user IDs to delete.
configZIMFriendDeleteConfigDelete friends related Configuration.

Details

Through this interface, the specified user can be deleted from the friend list.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [friendListChanged].
  • Available since: 2.14.0 or above.

Return

Delete friends result callback.

checkFriendsRelation

checkFriendsRelation
checkFriendsRelation(userIDs: string[], config: ZIMFriendRelationCheckConfig): Promise<ZIMFriendsRelationCheckedResult>
Check friend relationships.

Parameters

NameTypeDescription
userIDsstring[]List of user IDs to check.
configZIMFriendRelationCheckConfigCheck the configuration related to friend relationships.

Details

Through this interface, you can check the friend relationship with the specified user.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendAddedResult].
  • Available since: 2.14.0 or above.

Return

Check the friend relationship result callback.

updateFriendAlias

updateFriendAlias
updateFriendAlias(friendAlias: string, userID: string): Promise<ZIMFriendAliasUpdatedResult>
Update friend alias.

Parameters

NameTypeDescription
friendAliasstringFriend alias.
userIDstringUser ID.

Details

Through this interface, the specified userID user can update the alias.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendAliasUpdatedResult].
  • Available since: 2.14.0 or above.

Return

Update a friend alias result callback.

updateFriendAttributes

updateFriendAttributes
updateFriendAttributes(friendAttributes: Record<string, string>, userID: string): Promise<ZIMFriendAttributesUpdatedResult>
Update friend attributes.

Parameters

NameTypeDescription
friendAttributesRecord<string, string>Friend attributes. Up to 5 can be set. The key of the attribute can only be selected from k0 to k4.
userIDstringUser ID.

Details

Through this interface, the specified userID user can update the attributes.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Available since: 2.14.0 or above.

Return

Update a friend attributes result callback.

acceptFriendApplication

acceptFriendApplication
acceptFriendApplication(userID: string, config: ZIMFriendApplicationAcceptConfig): Promise<ZIMFriendApplicationAcceptedResult>
Accept to friend request.

Parameters

NameTypeDescription
userIDstringUser ID.
configZIMFriendApplicationAcceptConfigAccept friend application configuration.

Details

After receiving the friend application, accept the friend application through this interface.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendApplicationAcceptedResult].
  • Available since: 2.14.0 or above.

Return

Accept the result callback of friend application.

rejectFriendApplication

rejectFriendApplication
rejectFriendApplication(userID: string, config: ZIMFriendApplicationRejectConfig): Promise<ZIMFriendApplicationRejectedResult>
Accept to friend request.

Parameters

NameTypeDescription
userIDstringUser ID.
configZIMFriendApplicationRejectConfigReject friend application configuration.

Details

After receiving the friend application, reject the friend application through this interface.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendApplicationRejectedResult].
  • Available since: 2.14.0 or above.

Return

Reject the result callback of friend application.

queryFriendsInfo

queryFriendsInfo
queryFriendsInfo(userIDs: string[]): Promise<ZIMFriendsInfoQueriedResult>
Query friend information in batches.

Parameters

NameTypeDescription
userIDsstring[]User ID list.

Details

If you need to query the information of a group of designated friends for display, you can query it through this interface.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendListQueriedResult].
  • Available since: 2.14.0 or above.

Return

Result callback for querying friend information in batches.

queryFriendList

queryFriendList
queryFriendList(config: ZIMFriendListQueryConfig): Promise<ZIMFriendListQueriedResult>
Query the friends list.

Parameters

NameTypeDescription
configZIMFriendListQueryConfigQuery the configuration of the friend list.

Details

The list of friends that need to be paged can be queried through this interface.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendListQueriedResult].
  • Available since: 2.14.0 or above.

Return

Query the friend list and return results.

queryFriendApplicationList

queryFriendApplicationList
queryFriendApplicationList(config: ZIMFriendApplicationListQueryConfig): Promise<ZIMFriendApplicationListQueriedResult>
Query the friend application list.

Parameters

NameTypeDescription
configZIMFriendApplicationListQueryConfigQuery the friend application list configuration.

Details

If you need to paginate to query the list of friend applications, you can query through this interface.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendApplicationListQueriedResult].
  • Available since: 2.14.0 or above.

Return

Query the returned results of the friend application list.

searchLocalFriends

searchLocalFriends
searchLocalFriends(config: ZIMFriendsSearchConfig): Promise<ZIMFriendsSearchedResult>
Search local friends.

Parameters

NameTypeDescription
configZIMFriendsSearchConfigFriends search configuration.

Details

Through this interface, you can search for local friend information based on keywords.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMFriendsSearchedResult].
  • Available since: 2.14.0 or above.

Return

Search local friend information and return results.

addUsersToBlacklist

addUsersToBlacklist
addUsersToBlacklist(userIDs: string[]): Promise<ZIMBlacklistUsersAddedResult>
Add users to blacklist.

Parameters

NameTypeDescription
userIDsstring[]The list of userIDs to be added to blacklist.

Details

Through this interface, a user with the specified userID can be added to the blacklist.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMBlacklistUsersAddedResult].

Usage restrictions: The number of userID passed in at one time cannot exceed 20.

  • Available since: 2.13.0 or above.

removeUsersFromBlacklist

removeUsersFromBlacklist
removeUsersFromBlacklist(userIDs: string[]): Promise<ZIMBlacklistUsersRemovedResult>
Remove the user from the blacklist.

Parameters

NameTypeDescription
userIDsstring[]userID list.

Details

Through this interface, the user with the specified userID can be removed from the blacklist.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMBlacklistUsersRemovedResult].

Usage restrictions: The number of userID passed in at one time cannot exceed 20.

  • Available since: 2.13.0 or above.

queryBlacklist

queryBlacklist
queryBlacklist(config: ZIMBlacklistQueryConfig): Promise<ZIMBlacklistQueriedResult>
Query the blacklist.

Parameters

NameTypeDescription
configZIMBlacklistQueryConfigQuery the blacklist configuration.

Details

Query the blacklist.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMBlacklistQueriedResult].
  • Available since: 2.13.0 or above.

checkUserIsInBlacklist

checkUserIsInBlacklist
checkUserIsInBlacklist(userID: string): Promise<ZIMBlacklistCheckedResult>
Check if the user is on the blacklist.

Parameters

NameTypeDescription
userIDstringThe user ID information that needs to be checked is required.

Details

Through this interface, you can check whether a certain userID is on the blacklist.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMBlacklistCheckedResult].
  • Available since: 2.13.0 or above.

querySubscribedUserStatusList

querySubscribedUserStatusList
querySubscribedUserStatusList(config: ZIMSubscribedUserStatusQueryConfig): Promise<ZIMSubscribedUserStatusListQueriedResult>
This command is used to query the user status subscription list of the current user.

Parameters

NameTypeDescription
configZIMSubscribedUserStatusQueryConfigQuery the parameters related to the subscription list.

Details

This command is used to query the user status subscription list of the current user.

  • Use cases: Through this interface, you can obtain the local cache of the user status subscription list of the current user, so that you can know which users the current user has subscribed to, obtain the subscription expiration time of the subscriber, and obtain the status data of the subscriber when it changed last time.
  • When to call /Trigger: It can be called after login, regardless of network status.
  • Related callbacks: ZIMSubscribedUserStatusListQueriedCallback、subscribeUsersStatus、unsubscribeUsersStatus.
  • Related APIs: subscribeUsersStatus、unsubscribeUsersStatus.
  • Available since: 2.18.0
  • Restrictions: The data obtained is the local cache of the SDK. When the network conditions are good after login, the SDK periodically synchronizes data to the background.

Return

Result callback.

queryUsersStatus

queryUsersStatus
queryUsersStatus(userIDs: string[]): Promise<ZIMUsersStatusQueriedResult>
Query the user statuses of other users.

Parameters

NameTypeDescription
userIDsstring[]The query target user list.

Details

Query the user statuses of other users.

  • Use cases: When you do not need to continuously follow the user statuses of certain users but only need to obtain their user statuses once, you can use this method.
  • When to call /Trigger: Can be called after login and when the network conditions are good.

The query targets can not include unregistered users.

  • Related callbacks: ZIMUsersStatusQueriedCallback.
  • Available since: 2.18.0

Return

Result callback.

subscribeUsersStatus

subscribeUsersStatus
subscribeUsersStatus(userIDs: string[], config: ZIMUserStatusSubscribeConfig): Promise<ZIMUsersStatusSubscribedResult>
Subscribe to the user status of other users

Parameters

NameTypeDescription
userIDsstring[]List of subscribed users.
configZIMUserStatusSubscribeConfigSubscribe to the relevant configuration items.

Details

Subscribing to the user status of other users through this interface.

  • Use cases: When you enter the group/room/friends list and need to know which room/group members/friends are online, subscribe through this interface. When the user status of these users is updated successfully, the [userStatusUpdated] interface is updated.
  • When to call /Trigger: Can be called when the login is successful and the network conditions are good.
  • Caution: You cannot subscribe to the current login user through this interface. The subscribed user must be registered.
  • Related callbacks: [ZIMUsersStatusSubscribedResult],[userStatusUpdated]
  • Related APIs: [unsubscribeUsersStatus]
  • Available since: 2.18.0
  • Restrictions: The maximum number of subscribers is 100. By default, a single user can subscribe to a maximum of 3000 users. When the number of subscribers reaches the upper limit, the new subscribers will overwrite the original subscribers.

Return

Result callback.

unsubscribeUsersStatus

unsubscribeUsersStatus
unsubscribeUsersStatus(userIDs: string[]): Promise<ZIMUsersStatusUnsubscribedResult>
This command is used to batch unsubscribe the target users in the current user subscription list.

Parameters

NameTypeDescription
userIDsstring[]List of users that have been canceled in batch.

Details

Batch unsubscribe the target user in the current user subscription list.

  • Use cases: In non-multi-terminal login scenarios, when you leave a room or group, if you no longer follow the user status of the room or group members for a short period of time, and you have subscribed to the user status of the room or group members when you enter the room or group, you can unsubscribe through this interface.
  • When to call /Trigger: Called after login and when the network is in good condition.
  • Caution: You cannot cancel a user that is not in the current user subscription list.
  • Related callbacks: ZIMUsersStatusUnsubscribedCallback.
  • Related APIs: subscribeUsersStatus、queryUsersStatus、querySubscribedUserStatusList.
  • Available since: 2.18.0
  • Restrictions: The maximum number of userids passed in at a time is 100.

Return

Result callback.

updateUserCustomStatus

updateUserCustomStatus
updateUserCustomStatus(customStatus: string): ZIMUserCustomStatusUpdatedResult
It is used to update the user-defined status.

Parameters

NameTypeDescription
customStatusstringDescription: User-defined status. The default maximum value is 64 bytes. The default expiration time is 1 day. At login, if the field is an empty string (which is the default), the current user's custom state is not modified.

Details

You can define the status, such as DND and Busy, based on your service requirements.

  • Use cases: After login, call the interface to modify the current user's custom status as "do not disturb", "busy" and other states.
  • When to call /Trigger: After an online login and a network connection exists.
  • Related callbacks: After the interface is successfully invoked to update the user-defined status, other devices that are logged in to multiple devices and users who subscribe to the current user status through subscribeUsersStatus receive onUserStatusUpdated and updates the user-defined status of the current user.
  • Available since: 2.20.0 and later.
  • Restrictions: 1 time/second

Return

The result of the custom status update.

updateUserOfflinePushRule

updateUserOfflinePushRule
updateUserOfflinePushRule(offlinePushRule: ZIMUserOfflinePushRule): Promise<ZIMUserOfflinePushRuleUpdatedResult>
Modify the custom rule of offline push

Parameters

NameTypeDescription
offlinePushRuleZIMUserOfflinePushRuleThe user pushes the rule information offline, and the interface will be fully updated with the member properties of the input object each time the interface is called.

Details

This interface is used to modify the custom rule of offline push for the current user.

  • Use cases: For example, in the multi-terminal login scenario, the developer hopes that when the desktop is online, the mobile terminal does not want to receive offline push. In this scenario, the interface can be invoked to achieve this function.
  • When to call /Trigger: You can call it after you log in and the network is in good condition.
  • Caution: After the interface is successfully invoked, all ends will receive onUserRuleUpdate notifying the user that the rule has been updated.
  • Related callbacks: userRuleUpdate、ZIMUserOfflinePushRuleUpdatedResult
  • Related APIs: querySelfUserInfo
  • Available since: 2.15.0 and later versions.

Return

Modify the result callback of offline push.

querySelfUserInfo

querySelfUserInfo
querySelfUserInfo(): Promise<ZIMSelfUserInfoQueriedResult>
Query user information and user rules.

Query information about the current user and user rules. In offline state, you can query local data.

  • Use cases: If you need to display the user information and rules, you can invoke the query, for example, to enter the personal page of the current user.
  • When to call /Trigger: Call after login.
  • Available since: 2.15.0 及以后版本。
  • Restrictions: ZIMSelfUserInfoQueriedCallback、userInfoUpdated、userRuleUpdated

Callback result of querying user information and user rules.

on

on
on<K extends keyof ZIMEventHandler>(type: K, listener: ZIMEventHandler[K]): void
Register to listen for events.

Parameters

NameTypeDescription
typeKThe type of listener event.
listenerZIMEventHandler[K]The callback of listener event.
  • Use cases: Relevant information can be obtained by registering a specified method.
  • When to call: After SDK is initialized.
  • Available since: 1.1.0

off

off
off<K extends keyof ZIMEventHandler>(type: K): void
Delete listener event.

Parameters

NameTypeDescription
typeKThe type of listener event.

Details

The specified monitoring event can be deleted.

  • When to call: After initializing the SDK and registering the listener event.
  • Available since: 1.1.0

setLogConfig

setLogConfig
setLogConfig(config: ZIMLogConfig): void
Set log related configuration.

Parameters

NameTypeDescription
configZIMLogConfigLog configuration object.
  • Default value: The log level is info.

Calling timing: It must be after calling [create] to create an instance.

  • Platform differences: The default values ​​of different platforms are different, please refer to the default values.

Related reference: For details, please refer to https://doc-zh.zego.im/faq/IM_sdkLog?product=IM&platform=all.

login

login
deprecated
login(userInfo: ZIMUserInfo, token: string): Promise<void>
Login, you must log in before using all functions.

Parameters

NameTypeDescription
userInfoZIMUserInfoUnique ID used to identify the user. Note that the userID must be unique under the same appID, otherwise mutual kicks out will occur.
Note: Do not set ZIMUserInfo.userAvatarUrl through this interface.
tokenstringThe token issued by the developer's business server, used to ensure security. The generation rules are detailed in ZEGO document website. The token validity period cannot exceed 24 days.
  • Related callbacks: In addition to getting the login result in the Promise callback result, the developer will also receive the [connectionStateChanged] callback during the login request and after the login success/failure, which is used to determine the current user's login status.

Related reference: For details, please refer to Authentication (https://docs.zegocloud.com/article/13942).

Deprecated
This API has been deprecated since 2.13.0. Please use the [login] API instead.

Return

Callback of login result.

login

login
login(userID: string, config: ZIMLoginConfig): Promise<void>
Login, you must log in before using all functions.

Parameters

NameTypeDescription
userIDstringUsed to identify user information, the unique ID of the user.
configZIMLoginConfigVarious parameters used for specific login actions.
  • Related callbacks: In addition to getting the login result in the Promise callback result, the developer will also receive the [connectionStateChanged] callback during the login request and after the login success/failure, which is used to determine the current user's login status.

Related reference: For details, please refer to Authentication (https://docs.zegocloud.com/article/13942).

Return

Callback of login result.

renewToken

renewToken
renewToken(token: string): Promise<ZIMTokenRenewedResult>
Update the authentication token.

Parameters

NameTypeDescription
tokenstringThe token issued by the developer's business server, used to ensure security. The generation rules are detailed in ZEGO document website.

Details

Update the authentication token so that the authentication token can be updated in time after it expires, so as to continue to use ZIM functions normally.

  • Use cases: When you need to create a multi-person chat scene, you can create and join a room by this API.
  • When to call: This function must be called through the instance after calling [create] to create the instance.
  • Caution: After the developer receives the [onTokenWillExpire] callback, the developer needs to request the authentication server to regenerate a token in time.
  • Available since: 1.1.0 or above.

Return

Callback of the renewing token result.

queryUsersInfo

queryUsersInfo
queryUsersInfo(userIDs: string[], config: ZIMUsersInfoQueryConfig): Promise<ZIMUsersInfoQueriedResult>
Query user information.

Parameters

NameTypeDescription
userIDsstring[]userID list.
configZIMUsersInfoQueryConfigQuery user information configuration.

Details

Through this interface, you can query and obtain the corresponding UserInfo by userID.

  • When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
  • Related callbacks: [ZIMUsersInfoQueriedCallback].

Usage restrictions: No more than 10 userids can be queried by invoking the interface at a time. If the interface is invoked multiple times within 10 seconds, the total number of userids queried cannot exceed 10.

  • Available since: 2.3.0 or above.

Return

Callback of the query user result.

updateUserName

updateUserName
updateUserName(userName: string): Promise<ZIMUserNameUpdatedResult>
Update user's user name.

Parameters

NameTypeDescription
userNamestringUser name , It is customized by the developer. For version 2.0.0 and onwards, the string has a maximum length of 256 bytes.

Details

After user logs in, calling this interface could update the user's own user name.

  • When to call: After the user is logged in.

This interface does not support modifying user names in rooms.

  • Privacy reminder: Try not to pass in sensitive information involving personal privacy, including but not limited to mobile phone numbers, ID numbers, passport numbers, real names, etc.
  • Related callbacks: [ZIMUserNameUpdatedCallback].
  • Related APIs: [updateUserExtendedData] and [queryUsersInfo].
  • Available since: 2.2.0 or above.

Return

The result of the update user name.

updateUserAvatarUrl

updateUserAvatarUrl
updateUserAvatarUrl(userAvatarUrl: string): Promise<ZIMUserAvatarUrlUpdatedResult>
Update user's avatar URL.

Parameters

NameTypeDescription
userAvatarUrlstringUser avatar URL wanted to changed to .

Details

Supported versions: 2.3.0 and above.

Detail description: After the user logs in, calling this interface can set or update the user's own user avatar URL.

Call timing/notify timing: After the user logs in.

The user avatar itself needs to be stored by the developer, and ZIM only saves its user information as a pass-through URL.

Usage Restriction: There is no limit on special characters and a maximum of 500 bytes.

Related callback: [ZIMUserAvatarUrlUpdatedCallback].

Related interface: [queryUsersInfo].

Return

The result of the update user avatar URL.

updateUserExtendedData

updateUserExtendedData
updateUserExtendedData(extendedData: string): Promise<ZIMUserExtendedDataUpdatedResult>
Update user's user extended data.

Parameters

NameTypeDescription
extendedDatastringUser extended data wanted to changed to .

Details

After user logs in, calling this interface could update the user's own user extended data.

  • When to call: After the user is logged in.
  • Privacy reminder: Try not to pass in sensitive information involving personal privacy, including but not limited to mobile phone numbers, ID numbers, passport numbers, real names, etc.
  • Related callbacks: [ onUserNameUpdatedCallback ].
  • Related APIs: [updateUserName] and [ queryUsersInfo ].
  • Available since: 2.2.0 or above.

Return

The result of the update user extended data.

uploadLog

uploadLog
uploadLog(): Promise<void>
Upload log and call after setting up log path.

Supported version: 1.2.0 and above.

Detailed description: When this function is called, the SDK automatically packages and uploads the log file to the ZEGO server.

Use case: Developers can provide business "feedback" channels in the App. When user feedback problems belong to ZEGO SDK, they can call this function to upload the local log information of SDK and contact ZEGO technical support to help locate user problems.

Calling timing: After creating a ZIM instance via [create] and logging in with [login].

If you call [Destory] or exit the App too quickly after calling this interface to upload logs, it may fail. You are advised to wait a few seconds and then call [Destory] or exit the App after receiving the callback for successful upload.

The result of the log upload.

logout

logout
logout(): void
Log out of ZIM service.

Log out of the ZIM service.

  • Use cases: This function must be called from the instance after it has been created by calling [create].
  • When to call: After invoking [logout], you can no longer use ZIM's chat, room, send and receive, and other functions. To use the ZIM service again, the developer must call [login] to login again.
  • Caution: Upon logout, the developer will receive the [onConnectionStateChanged] callback with the login state being [Disconnected].
  • Available since: 1.1.0 or above.

destroy

destroy
destroy(): void
Destroy the ZIM instance.

Supported version: 1.1.0 and above.

Detailed description: Release the resources used by the ZIM instance. This function must be called to release the occupied memory resources when ZIM is no longer needed, otherwise a memory leak may occur.

Call timing: call when ZIM is no longer needed, usually before emptying the ZIM object.

After calling this function, ZIM internal functions can no longer be used, and all callback notifications will no longer be triggered. If you need to continue using the ZIM function, please call [create] again to create a new instance.

callInvite

callInvite
callInvite(invitees: string[], config: ZIMCallInviteConfig): Promise<ZIMCallInvitationSentResult>
Initiate a call invitation.

Parameters

NameTypeDescription
inviteesstring[]list of invitees.
configZIMCallInviteConfigCall Invitation Related Configuration.
  • When to call: It can be called after creating a ZIM instance through [create].

The call invitation has a timeout period, and the call invitation will end when the timeout period expires.

  • Related callbacks: [ZIMCallInvitationSentCallback].

Return

Callback of the call invite result.

callJoin

callJoin
callJoin(callID: string, config: ZIMCallJoinConfig): Promise<ZIMCallJoinSentResult>
Join an advanced mode call, or switch the main device for the advanced mode call (multi-terminal login only).

Parameters

NameTypeDescription
callIDstringThe advanced call ID which user wants to join.
configZIMCallJoinConfigRelated configuration for join call invitations.

Details

After create an advanced mode call invitation, you can invoke this interface to join the call or switch the primary device.

  • Use cases: Users who are not in the call join the call, and users who are already in the call switch to the primary device.
  • When to call: Need to be invoked after logged in.
  • Available since: 2.12.0.

Return

The callback of the operation to join the call or switch to the main device.

callCancel

callCancel
callCancel(invitees: string[], callID: string, config: ZIMCallCancelConfig): Promise<ZIMCallCancelSentResult>
Cancel the call invitation.

Parameters

NameTypeDescription
inviteesstring[]List of invitees.
callIDstringThe ID of the call invitation to cancel.
configZIMCallCancelConfigCancel the related configuration of call invitation.
  • When to call: It can be called after creating a ZIM instance through [create].

Canceling the call invitation after the timeout period of the call invitation expires will fail.

  • Related callbacks: [ZIMCallCancelSentCallback].

Return

Callback of the call cancel result.

callAccept

callAccept
callAccept(callID: string, config: ZIMCallAcceptConfig): Promise<ZIMCallAcceptanceSentResult>
Accept the call invitation.

Parameters

NameTypeDescription
callIDstringThe call invitation ID to accept.
configZIMCallAcceptConfigConfiguration related to accepting call invitations.
  • When to call: It can be called after creating a ZIM instance through [create].

The callee will fail to accept an uninvited callid.

  • Related callbacks: [ZIMCallAcceptanceSentCallback].

Return

Callback of the call accept result.

callReject

callReject
callReject(callID: string, config: ZIMCallRejectConfig): Promise<ZIMCallRejectionSentResult>
Reject the call invitation.

Parameters

NameTypeDescription
callIDstringThe ID of the call invitation to be rejected.
configZIMCallRejectConfigRelated configuration for rejecting call invitations.
  • When to call: It can be called after creating a ZIM instance through [create].

The callee will fail to reject the uninvited callid.

  • Related callbacks: [ZIMCallRejectionSentCallback].

Return

Callback of the call reject result.

callQuit

callQuit
callQuit(callID: string, config: ZIMCallQuitConfig): Promise<ZIMCallQuitSentResult>
Reject the call invitation.

Parameters

NameTypeDescription
callIDstringThe ID of the call invitation to be quit.
configZIMCallQuitConfigRelated configuration for quit call invitations.
  • When to call: After a call is established, users whose call status is accept can call this interface.

The callee will fail to quit the uninvited callId.

  • Related callbacks: [ZIMCallQuitSentResult].

Return

Callback of the call quit result.

callEnd

callEnd
callEnd(callID: string, config: ZIMCallEndConfig): Promise<ZIMCallEndSentResult>
End the call invitation.

Parameters

NameTypeDescription
callIDstringThe ID of the call invitation to be ended.
configZIMCallEndConfigRelated configuration for end call invitations.
  • When to call: The call was in advanced mode and the user status was Accepted.

User calls that are not in the call will fail. ZIM SDK Does not have service logic after the call ends, and developers can customize the development logic after the end.

  • Related callbacks: [ZIMCallEndSentResult].

Return

Callback of the call end result.

callingInvite

callingInvite
callingInvite(invitees: string[], callID: string, config: ZIMCallingInviteConfig): Promise<ZIMCallingInvitationSentResult>
Invite other users to join the call invitation

Parameters

NameTypeDescription
inviteesstring[]List of invited user ids.
callIDstringcallID of the current call in advanced mode.
configZIMCallingInviteConfigThis section describes how to configure the call invitation.
  • When to call: After calling [callInvite] to initiate a call invitation in advanced mode.

User calls that are not in the call will fail. ZIM SDK has no relevant business logic after accepting. Developers can customize the development logic after adding calls. By default, a call can contain a maximum of 9 users.

  • Related callbacks: [ZIMCallingInvitationSentCallback].

Return

Callback result of inviting the current call.

queryCallInvitationList

queryCallInvitationList
queryCallInvitationList(config: ZIMCallInvitationQueryConfig): Promise<ZIMCallInvitationListQueriedResult>
Query call invitation list

Parameters

NameTypeDescription
configZIMCallInvitationQueryConfigQuery the relevant configuration of the call invitation list.
  • When to call: Run [create] to create a ZIM instance, which can be invoked after login.
  • Related callbacks: [ZIMQueryCallInvitationListResult].

Return

Inquire the results of the call invitation list.

searchLocalGroups

searchLocalGroups
searchLocalGroups(config: ZIMGroupSearchConfig): Promise<ZIMGroupsSearchedResult>
Search local groups.

Parameters

NameTypeDescription
configZIMGroupSearchConfigConfiguration for searching groups.
  • Related callbacks: [ZIMGroupsSearchedResult].
  • Restrictions: Takes effect after login, becomes invalid after logout.

Return

Callback of the search groups result.

searchLocalGroupMembers

searchLocalGroupMembers
searchLocalGroupMembers(groupID: string, config: ZIMGroupMemberSearchConfig): Promise<ZIMGroupMembersSearchedResult>
Search local group members.

Parameters

NameTypeDescription
groupIDstringGroup ID of the joined group.
configZIMGroupMemberSearchConfigThe configuration for searching group members.
  • Related callbacks: [ZIMGroupMembersSearchedResult].
  • Restrictions: Takes effect after login, becomes invalid after logout.

Return

Callback for the result of searching group members.

createGroup

createGroup
createGroup(groupInfo: ZIMGroupInfo, userIDs: string[], config: ZIMGroupAdvancedConfig): Promise<ZIMGroupCreatedResult>
Create a group with the andvanced info such as group attributes and group notice.

Parameters

NameTypeDescription
groupInfoZIMGroupInfoConfiguration information for the group to be created.
userIDsstring[]List of users invited to the group.
configZIMGroupAdvancedConfigCreate the relevant configuration of the group.

Details

You can call this interface to create a group, and the person who calls this interface is the group leader.

  • Use cases: You can use this interface to create a chat scenario and join a group.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Caution: Available after login, unavailable after logout. UserIDs can have a maximum of 100 users and a group can have a maximum of 500 users.
  • Related callbacks: The result of creating the group is obtained through the [ZIMGroupCreatedCallback] callback.
  • Related APIs: You can use [joinGroup] to join a group, [leaveGroup] to leave a group, or [dismissGroup] to dismiss a group.
  • Available since: 2.0.0 and above.

Return

Callback for the result of creating a group.

joinGroup

joinGroup
joinGroup(groupID: string): Promise<ZIMGroupJoinedResult>
join a goup.

Parameters

NameTypeDescription
groupIDstringThe group ID to join.

Details

When a group is created, other users can join the group through [joinGroup]. If the group does not exist, the joining fails.

  • Use cases: This interface is used to join a group in a chat scenario.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Caution: Available after login, unavailable after logout. If you have joined a group, the join succeeds.
  • Related callbacks: To get the result of joining the room, call [ZIMGroupJoinedCallback].
  • Related APIs: You can use [createGroup] to create a group, [leaveGroup] to leave a group, or [dismissGroup] to dismiss a group.
  • Available since: 2.0.0 and above.

Return

Callback for the result of joining the group.

leaveGroup

leaveGroup
leaveGroup(groupID: string): Promise<ZIMGroupLeftResult>
Leave the group.

Parameters

NameTypeDescription
groupIDstringThe group ID to leave.

Details

After a user joins a group, the user can leave the group through this interface.

  • Use cases: This interface is used to exit a chat group.
  • When to call /Trigger: It can be invoked after a ZIM instance is created through [create] and logged in.
  • Caution: When the group owner quits the group, the identity of the group owner will be automatically transferred to the earliest member who joined the group. When all members exit the group, the group is automatically dissolved.
  • Impacts on other APIs: You can use [createGroup] to create a group, [joinGroup] to join a group, or [dismissGroup] to dismiss a group.
  • Related callbacks: The result of leaving the room can be obtained by the [ZIMGroupLeftCallback] callback.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for the result of leaving the group.

dismissGroup

dismissGroup
dismissGroup(groupID: string): Promise<ZIMGroupDismissedResult>
Disband the group.

Parameters

NameTypeDescription
groupIDstringThe ID of the group to be disbanded.

Details

When a group is created, you can use [dismissGroup] to dismiss it.

  • Use cases: After you create a chat group, you do not need to use this interface to dissolve the group.
  • When to call /Trigger: This parameter can be called after a group is created by using [createGroup].
  • Caution: A non-group owner cannot dissolve a group.
  • Related callbacks: Through callback can get [ZIMGroupDismissedCallback] dissolution results of the room, through [onGroupStateChanged] listen callback can get the room status.
  • Related APIs: You can use [createGroup] to create a group, [joinGroup] to join a group, and [leaveGroup] to leave a group.
  • Available since: 2.0.0 and above.

Return

Callback for the result of disbanding the group.

kickGroupMembers

kickGroupMembers
kickGroupMembers(userIDs: string[], groupID: string): Promise<ZIMGroupMemberKickedResult>
kick some members out of the group.

Parameters

NameTypeDescription
userIDsstring[]List of users who have been kicked out of the group.
groupIDstringThe group ID of the member who will be kicked out.

Details

After a user joins a group, you can use this method to remove the user from the group.

  • Use cases: You can use this method to remove one or more users from the group.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Caution: This interface does not require the peer's consent or the peer's online status. It cannot accept group-related callbacks after being kicked out. History messages and sessions remain after being kicked out and can still enter the group.
  • Related callbacks: Through the callback [ZIMGroupMemberKickedCallback] can get the user kicked out the results of the group.
  • Related APIs: You can invite a target user into a group through [inviteUsersIntoGroup].
  • Available since: 2.0.0 and above.
  • Restrictions: You can't kick someone unless you're the leader of the group.

Return

Callback for the result of being kicked out of the group.

inviteUsersIntoGroup

inviteUsersIntoGroup
inviteUsersIntoGroup(userIDs: string[], groupID: string): Promise<ZIMGroupUsersInvitedResult>
invite some members into the group.

Parameters

NameTypeDescription
userIDsstring[]List of users who have been invited to the group, the maximum number supported in a single operation is 100.
groupIDstringThe group ID of the member who will be invited to join.

Details

When users need to be invited to join the group, they can be invited to the group by this method. If the group does not exist, the invitation will fail.

  • Use cases: You can use this method to invite one or more users to the group.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Caution: This interface does not require the peer's consent or the peer's online status.
  • Related callbacks: Through the callback [ZIMGroupUsersInvitedCallback] can get the user invited to the results of the group.
  • Related APIs: You can kick out a target user into a group through [kickGroupMembers].
  • Available since: 2.0.0 and above.
  • Restrictions: You can't invite someone unless you're the leader of the group.

Return

Callback for the result of being invited to the group.

transferGroupOwner

transferGroupOwner
transferGroupOwner(toUserID: string, groupID: string): Promise<ZIMGroupOwnerTransferredResult>
Transfer the group owner.

Parameters

NameTypeDescription
toUserIDstringThe converted group owner ID.
groupIDstringThe group ID of the group owner to be replaced.

Details

After a group is created, the group owner can use this method to assign the group owner to a specified user.

  • Use cases: In a group chat scenario, you can transfer the group master through this interface.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupOwnerTransferredCallback] can get the result of the transfer of the group manager.
  • Available since: 2.0.0 and above.
  • Restrictions: You cannot transfer a group owner if you are not a group owner.

Return

The callback of the transfer group owner.

updateGroupAlias

updateGroupAlias
updateGroupAlias(groupAlias: string, groupID: string): Promise<ZIMGroupAliasUpdatedResult>
Update the group alias.

Parameters

NameTypeDescription
groupAliasstringThe new group alias. Maximum length is 256 bytes.
groupIDstringThe group ID whose group alias will be updated.

Details

After a group is created, users can call this method to change the group alias.

  • Use cases: To distinguish different group.
  • When to call: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupAliasUpdatedResult] can get the result of the change of group alias.
  • Available since: 2.18.0 and above.

Return

The result of updating the group alias.

updateGroupName

updateGroupName
updateGroupName(groupName: string, groupID: string): Promise<ZIMGroupNameUpdatedResult>
Update the group name.

Parameters

NameTypeDescription
groupNamestringThe group name that needs to be updated.
groupIDstringThe group ID whose group name will be updated.

Details

After a group is created, users can call this method to change the group name.

  • Use cases: After creating a group, you need to change the group name.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupNameUpdatedCallback] can get the result of the change of name, through [onGroupNoticeUpdated] can get update group name information.
  • Available since: 2.0.0 and above.
  • Restrictions: Group members and group owners can change the group name. The maximum length of the name is 100 bytes.

Return

Callback for the result of updating the group name.

muteGroup

muteGroup
muteGroup(isMute: boolean, groupID: string, config: ZIMGroupMuteConfig): Promise<ZIMGroupMutedResult>
Mute a group

Parameters

NameTypeDescription
isMutebooleanIdentify the action as either muting the group or unmuting the group.
groupIDstringThe group ID whose group mute info will be updated.
configZIMGroupMuteConfigConfiguration for group mute.

Details

Once a group is created, the group administrator can call this interface to implement group muting and unmuting.

  • Use cases: After creating a group, users need to change the mute status of the group.
  • When to call: This can be called after a ZIM instance is created using [create] and logged into the group.
  • Related callbacks: The result of changing the group mute status can be obtained through the [ZIMGroupMutedResult]. The updated group mute status information can be obtained through [groupMuteInfoUpdated].
  • Available since: 2.14.0 and above.
  • Restrictions: This can be called by the group owner and group administrators.

Return

Callback for the result of updating the group mute info.

muteGroupMembers

muteGroupMembers
muteGroupMembers(isMute: boolean, userIDs: string[], groupID: string, config: ZIMGroupMemberMuteConfig): Promise<ZIMGroupMembersMutedResult>
Mute group members.

Parameters

NameTypeDescription
isMutebooleanIdentify the action as either muting the group members or unmuting the group members.
userIDsstring[]The group member ID that needs to change the mute status.
groupIDstringThe group ID whose group members mute info will be updated.
configZIMGroupMemberMuteConfigConfiguration for group members mute.

Details

Once a group is created, the group administrator can call this interface to implement group members muting and unmuting.

  • Use cases: After creating a group, users need to change the mute status of the group members.
  • When to call: This can be called after a ZIM instance is created using [create] and logged into the group.
  • Related callbacks: The result of changing the group members mute status can be obtained through the [ZIMGroupMembersMutedResult]. The updated group members mute status information can be obtained through [groupMemberInfoUpdated].
  • Available since: 2.14.0 and above.
  • Restrictions: This can be called by the group owner and group administrators.

Return

Callback for the result of updating the group members mute info.

updateGroupAvatarUrl

updateGroupAvatarUrl
updateGroupAvatarUrl(groupAvatarUrl: string, groupID: string): Promise<ZIMGroupAvatarUrlUpdatedResult>
Update the group avatar URL.

Parameters

NameTypeDescription
groupAvatarUrlstringThe group avatar URL that needs to be updated.

Usage Restriction: There is no limit on special characters and a maximum of 500 bytes.
groupIDstringThe group ID of the group avatar URL that will be updated.
  • Related callbacks: The result of changing the group name can be obtained through the [ZIMGroupAvatarUrlUpdatedCallback] callback, and the updated group avatar information can be obtained through the [onGroupAvatarUrlUpdated] callback.

Return

Callback for the result of updating the group avatar URL.

updateGroupNotice

updateGroupNotice
updateGroupNotice(groupNotice: string, groupID: string): Promise<ZIMGroupNoticeUpdatedResult>
Update group announcements.

Parameters

NameTypeDescription
groupNoticestringPre-updated group announcements.
groupIDstringThe group ID of the group announcement that will be updated.

Details

When a group is created, users can use this method to update the group bulletin.

  • Use cases: You need to update the group bulletin in the group.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through callback [ZIMGroupNoticeUpdateCallback] can get update group of the results announcement, announcement by [onGroupNoticeUpdated] can get update group information.
  • Available since: 2.0.0 and above.
  • Restrictions: Only group members can update the group bulletin. The maximum number of bytes is 300. There is no special character limit.

Return

Callback to update the results of group announcements.

updateGroupJoinMode

updateGroupJoinMode
updateGroupJoinMode(mode: ZIMGroupJoinMode, groupID: string): Promise<ZIMGroupJoinModeUpdatedResult>
Update group verification mode.

Parameters

NameTypeDescription
modeZIMGroupJoinModeGroup verification mode.
groupIDstringThe group ID.

Details

When a group is created, the group owner and administrators can use this method to update the group verification mode.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the update operation.

updateGroupInviteMode

updateGroupInviteMode
updateGroupInviteMode(mode: ZIMGroupInviteMode, groupID: string): Promise<ZIMGroupInviteModeUpdatedResult>
Update group verification mode.

Parameters

NameTypeDescription
modeZIMGroupInviteModeGroup verification mode.
groupIDstringThe group ID.

Details

When a group is created, the group owner and administrators can use this method to update the group verification mode.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the update operation.

acceptGroupInviteApplication

acceptGroupInviteApplication
acceptGroupInviteApplication(inviterUserID: string, groupID: string, config: ZIMGroupInviteApplicationAcceptConfig): Promise<ZIMGroupInviteApplicationAcceptedResult>
Accept an application to invite to the group.

Parameters

NameTypeDescription
inviterUserIDstringInviter user ID.
groupIDstringThe group ID.
configZIMGroupInviteApplicationAcceptConfigAgree to the configuration of the application to invite the group.

Details

When a group's beInviteMode mode is Auth, users outside the group can accept the invitation through this method and become group members after receiving the group invitation.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

acceptGroupJoinApplication

acceptGroupJoinApplication
acceptGroupJoinApplication(userID: string, groupID: string, config: ZIMGroupJoinApplicationAcceptConfig): Promise<ZIMGroupJoinApplicationAcceptedResult>
Accept an application to join the group.

Parameters

NameTypeDescription
userIDstringApplicant user ID.
groupIDstringThe group ID.
configZIMGroupJoinApplicationAcceptConfigAgree to the configuration of the application to join the group.

Details

When a group's joinMode requires Auth, after an external user sends a group application, the group owner or administrator can agree to the application through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

queryGroupApplicationList

queryGroupApplicationList
queryGroupApplicationList(config: ZIMGroupApplicationListQueryConfig): Promise<ZIMGroupApplicationListQueriedResult>
Query the group application list.

Parameters

NameTypeDescription
configZIMGroupApplicationListQueryConfigQuery the configuration of the application list.

Details

The query results include your own application to join the group and your application to be invited to join the group. When the user is a group owner or administrator, the query results will also include other people's applications to join the group and their own applications to invite others to the group.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

rejectGroupInviteApplication

rejectGroupInviteApplication
rejectGroupInviteApplication(inviterUserID: string, groupID: string, config: ZIMGroupInviteApplicationRejectConfig): Promise<ZIMGroupInviteApplicationRejectedResult>
Reject an application to invite to the group.

Parameters

NameTypeDescription
inviterUserIDstringInviter user ID.
groupIDstringThe group ID.
configZIMGroupInviteApplicationRejectConfigReject to the configuration of the application to invite the group.

Details

When a group's beInviteMode requires Auth, users invited to the group can reject the invitation through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

rejectGroupJoinApplication

rejectGroupJoinApplication
rejectGroupJoinApplication(userID: string, groupID: string, config: ZIMGroupJoinApplicationRejectConfig): Promise<ZIMGroupJoinApplicationRejectedResult>
Reject an application to join the group.

Parameters

NameTypeDescription
userIDstringApplicant user ID.
groupIDstringThe group ID.
configZIMGroupJoinApplicationRejectConfigReject to the configuration of the application to join the group.

Details

When a group's joinMode is Auth, the group owner or administrator can reject to the user's application to join the group through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

sendGroupInviteApplications

sendGroupInviteApplications
sendGroupInviteApplications(userIDs: string[], groupID: string, config: ZIMGroupInviteApplicationSendConfig): Promise<ZIMGroupInviteApplicationsSentResult>
Send an application to invite the group.

Parameters

NameTypeDescription
userIDsstring[]List of invited users, the maximum number supported in a single operation is 20.
groupIDstringThe group ID.
configZIMGroupInviteApplicationSendConfigInvite to the group to apply for configuration.

Details

When a group's invitation verification mode requires approval by the invitee, group members can send invitations to the group through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

sendGroupJoinApplication

sendGroupJoinApplication
sendGroupJoinApplication(groupID: string, config: ZIMGroupJoinApplicationSendConfig): Promise<ZIMGroupJoinApplicationSentResult>
Send an application to join the group.

Parameters

NameTypeDescription
groupIDstringThe group ID.
configZIMGroupJoinApplicationSendConfigJoin the group to apply for configuration.

Details

When a group's joinMode is Auth, users can apply to join the group through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the operation.

updateGroupBeInviteMode

updateGroupBeInviteMode
updateGroupBeInviteMode(mode: ZIMGroupBeInviteMode, groupID: string): Promise<ZIMGroupBeInviteModeUpdatedResult>
Update group verification mode.

Parameters

NameTypeDescription
modeZIMGroupBeInviteModeGroup verification mode.
groupIDstringThe group ID.

Details

After a group is created, the group owner and administrators can update the invited group verification mode through this method.

  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Available since: 2.15.0 and above.

Return

Callback for the result of the update operation.

queryGroupInfo

queryGroupInfo
queryGroupInfo(groupID: string): Promise<ZIMGroupInfoQueriedResult>
Query group information.

Parameters

NameTypeDescription
groupIDstringThe group ID of the group information to be queried.

Details

Query information about a created group.

  • Use cases: You need to obtain group information for display.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupInfoQueriedCallback] can query the result of the group information.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for the result of querying group information.

queryGroupList

queryGroupList
queryGroupList(): Promise<ZIMGroupListQueriedResult>
Query group list.

Query the list of all groups.

  • Use cases: You need to get a list of groups to display.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupListQueriedCallback] can get a check list of all current group results.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Callback for querying the result of the group list.

setGroupAttributes

setGroupAttributes
setGroupAttributes(groupAttributes: Record<string, string>, groupID: string): Promise<ZIMGroupAttributesOperatedResult>
Add or update group attributes.

Parameters

NameTypeDescription
groupAttributesRecord<string, string>group attributes.
groupIDstringgroupID.

Details

If a group already exists, all users of the group can use this method to set group attributes.

  • Use cases: Added extended field information about group description, such as group family, label, and industry category.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupAttributesOperatedCallback] can get the result of the set of attributes.
  • Related APIs: [deleteGroupAttributes] can be used to deleteGroupAttributes, [queryGroupAttributes] can be used to queryGroupAttributes, [queryAllGroupAttributes] can be used to queryAllGroupAttributes.
  • Available since: 2.0.0 and above.
  • Restrictions: Only group members can set group attributes.

Return

Callback for setting group attributes.

deleteGroupAttributes

deleteGroupAttributes
deleteGroupAttributes(keys: string[], groupID: string): Promise<ZIMGroupAttributesOperatedResult>
Delete group attribute.

Parameters

NameTypeDescription
keysstring[]The key of the group attribute to delete.
groupIDstringThe group ID of the group attribute to be deleted.

Details

When a group already exists, you can use this method to delete group attributes. Both the master and members of the interface group can be invoked.

  • Use cases: Deleted the extended field of the group description.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupAttributesOperatedCallback] can delete the result of the group of attributes.
  • Related APIs: You can use [setGroupAttributes] to setGroupAttributes, [queryGroupAttributes] to queryGroupAttributes, and [queryAllGroupAttributes] to queryAllGroupAttributes.
  • Available since: 2.0.0 and above.
  • Restrictions: Only group members can delete group attributes.

Return

Callback for the result of removing the group attributes.

queryGroupAttributes

queryGroupAttributes
queryGroupAttributes(keys: string[], groupID: string): Promise<ZIMGroupAttributesQueriedResult>
Query group attributes by keys.

Parameters

NameTypeDescription
keysstring[]The key of the group attribute to be queried.
groupIDstringThe group ID of the group attribute to be queried.

Details

After a group is created, you can use this method to query the specified group attributes.

  • Use cases: You need to query the scenarios to display the specified group attributes.
  • When to call /Trigger: After creating a ZIM instance with [create] and logging in with [login].
  • Related callbacks: Through the callback [ZIMGroupAttributesQuriedCallback] can get query attributes of the specified group of results.
  • Related APIs: [queryAllGroupAttributes] Queries all group attributes.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for the result of querying group attributes.

queryGroupAllAttributes

queryGroupAllAttributes
queryGroupAllAttributes(groupID: string): Promise<ZIMGroupAttributesQueriedResult>
Query all attributes of the group.

Parameters

NameTypeDescription
groupIDstringThe group ID of all group attributes to be queried.

Details

After a group is created, you can use this method to query all group attributes.

  • Use cases: Scenarios where all group attributes need to be queried.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through callback can get query [ZIMGroupAttributesQuriedCallback] all the results of the group of attributes.
  • Related APIs: [queryGroupAttributes] Queries the attributes of the specified group.
  • Available since: 2.0.0 and above.

Return

Callback for querying the result of all attributes of the group.

setGroupMemberRole

setGroupMemberRole
setGroupMemberRole(role: number, forUserID: string, groupID: string): Promise<ZIMGroupMemberRoleUpdatedResult>
Set the group member role.

Parameters

NameTypeDescription
rolenumberSet of group roles。
- 2: Administrator.
- 3: Ordinary members.
- Other values: The group role can be customized, and the permissions are the same as those of ordinary members. It is recommended that the value be greater than 100.
forUserIDstringUser ID for which group role is set.
groupIDstringThe group ID of the group role to be set.

Details

After a group is created, you can use this method to set the roles of group members.

  • Use cases: The ZIM instance can be invoked after being created by [create] and logged in.
  • When to call /Trigger: If the primary role of a group is 1 and the default role of other members is 3, you can invoke this interface to change the role.
  • Caution: The role of the group owner is 1, the role of the administrator is 2, and the role of the normal member is 3. You can modify it by calling this interface, but the role cannot be changed to 1. If you need to customize the role, it is recommended to set the value to 100 or higher, and its permissions will be the same as those of normal members.
  • Related callbacks: Through the callback [ZIMGroupMemberRoleUpdatedCallback] can be set up to get the results of the group of members of the role.
  • Available since: 2.0.0 and above.
  • Restrictions: Non-group master unavailable.

Return

Callback to set the result of the group member role.

setGroupMemberNickname

setGroupMemberNickname
setGroupMemberNickname(nickname: string, forUserID: string, groupID: string): Promise<ZIMGroupMemberNicknameUpdatedResult>
Set group member nickname.

Parameters

NameTypeDescription
nicknamestringSet member nickname.
forUserIDstringUser ID for which group nickname is set.
groupIDstringThe group ID of the group member's nickname is set.

Details

After a group is created, you can use this method to set nicknames for group members.

  • Use cases: Nicknames need to be set for group members.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Caution: A group member nickname can contain a maximum of 100 characters.
  • Related callbacks: Through the callback [ZIMGroupMemberNicknameUpdatedCallback] can be set up to get the results of the group members nickname.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout. The owner of a group can change his or her own nickname, while the members can change only their own nickname.

Return

Callback for the result of setting the group member's nickname.

queryGroupMemberInfo

queryGroupMemberInfo
queryGroupMemberInfo(userID: string, groupID: string): Promise<ZIMGroupMemberInfoQueriedResult>
Query group member information.

Parameters

NameTypeDescription
userIDstringUser ID of the queried member information.
groupIDstringThe ID of the group whose member information will be queried.

Details

After a group is created, you can use this method to query information about a specified group member.

  • Use cases: You need to obtain the specified group member information for display or interaction.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupMemberInfoQueriedCallback] can get the query specifies the result of group membership information.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for the result of querying group member information.

queryGroupMemberList

queryGroupMemberList
queryGroupMemberList(groupID: string, config: ZIMGroupMemberQueryConfig): Promise<ZIMGroupMemberListQueriedResult>
Query the list of group members.

Parameters

NameTypeDescription
groupIDstringThe group ID of the group member list to be queried.
configZIMGroupMemberQueryConfigGroup member query configuration.

Details

After a group is created, you can use this method to query the group member list.

  • Use cases: You need to obtain the specified group member list for display or interaction.
  • When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through the callback [ZIMGroupMemberListQueriedCallback] can query the result of the group member list.
  • Available since: 2.0.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for querying the list of group members.

queryGroupMemberMutedList

queryGroupMemberMutedList
queryGroupMemberMutedList(groupID: string, config: ZIMGroupMemberMutedListQueryConfig): Promise<ZIMGroupMemberMutedListQueriedResult>
Query the list of group muted members.

Parameters

NameTypeDescription
groupIDstringThe group ID of the group muted member list to be queried.
configZIMGroupMemberMutedListQueryConfigGroup muted member query configuration.

Details

After a group is created, you can use this method to query the group muted member list.

  • Use cases: You need to obtain the specified group muted member list for display or interaction.
  • When to call: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: Through [ZIMGroupMemberMutedListQueriedResult] can query the result of the group muted member list.
  • Available since: 2.14.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Result for querying the list of group muted members.

queryGroupMemberCount

queryGroupMemberCount
queryGroupMemberCount(groupID: string): Promise<ZIMGroupMemberCountQueriedResult>
Query the number of group members in a specified group.

Parameters

NameTypeDescription
groupIDstringThe group ID of the group to be queried.

Details

Query the number of group members in a group.

  • When to call: The ZIM instance can be invoked after being created by [create] and logged in.
  • Related callbacks: [ZIMGroupMemberCountQueriedCallback].
  • Available since: 2.2.0 or above.
  • Restrictions: This function can only query the group that the user has entered.

Return

Callback for querying the number of groups.

queryConversation

queryConversation
queryConversation(conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationQueriedResult>
Query a conversation by conversation ID and conversation type.

Parameters

NameTypeDescription
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type.

Details

This method displays the session list of the logged in user.

  • Use cases: When you need to know the relevant information of the specified conversation, you can call this interface to obtain the data source.
  • When to call /Trigger: Can be invoked after login.
  • Related callbacks: [ZIMConversationQueriedResult].
  • Available since: 2.8.0 and above.
  • Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.

Return

Callback of the query conversation result.

queryConversationList

queryConversationList
queryConversationList(config: ZIMConversationQueryConfig): Promise<ZIMConversationListQueriedResult>
Query the conversation list.

Parameters

NameTypeDescription
configZIMConversationQueryConfigConfiguration for session queries.

Details

This method displays the session list of the logged in user.

  • Use cases: This interface can be invoked to get the data source when you need to display an existing message session after logging in.
  • When to call /Trigger: Can be invoked after login.
  • Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
  • Related callbacks: [ZIMConversationListQueriedCallback].
  • Related APIs: [deleteConversation] Deletes the session. [clearConversationUnreadMessageCount] clear session readings.
  • Available since: 2.0.0 and above.
  • Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.

Return

Callback of the query conversation list result.

queryConversationList

queryConversationList
queryConversationList(config: ZIMConversationQueryConfig, callback: ZIMConversationListQueriedCallback): Promise<ZIMConversationListQueriedResult>
Query the conversation list by filter options.

Parameters

NameTypeDescription
configZIMConversationQueryConfigConfiguration for session queries.
callbackZIMConversationListQueriedCallbackCallback for conversation queried.

Details

This method allows you to query the conversation list of the logged-in user based on filter criteria.

  • Use cases: This interface can be invoked to get the data source when you need to display an existing message conversation after logging in.
  • When to call /Trigger: Can be invoked after login.
  • Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
  • Related callbacks: [ZIMConversationListQueriedCallback].
  • Available since: 2.17.0 and above.
  • Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.

Return

Callback of the query conversation list result.

queryConversationPinnedList

queryConversationPinnedList
queryConversationPinnedList(config: ZIMConversationQueryConfig): Promise<ZIMConversationPinnedListQueriedResult>
Query the conversation pinned list.

Parameters

NameTypeDescription
configZIMConversationQueryConfigConfiguration for session queries.

Details

This method displays the pinned conversation list of the logged in user.

  • Use cases: This interface can be invoked to get the data source when you need to display an existing pinned message conversation after logging in.
  • When to call /Trigger: Can be invoked after login.
  • Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
  • Available since: 2.8.0 and above.
  • Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.

Return

Callback for conversation pinned list query.

queryConversationTotalUnreadMessageCount

queryConversationTotalUnreadMessageCount
queryConversationTotalUnreadMessageCount(config: ZIMConversationTotalUnreadMessageCountQueryConfig): Promise<ZIMConversationTotalUnreadMessageCountQueriedResult>
Query the conversations total unread message count by config.

Parameters

NameTypeDescription
configZIMConversationTotalUnreadMessageCountQueryConfigConfiguration for conversation total unread message count queries.

Details

his method can query the total number of unread messages in the conversations of the logged-in user according to the configuration items.

  • Use cases: This interface can be invoked to get the data source when you need to display an existing message conversation after logging in.
  • When to call /Trigger: Can be called after logging in.
  • Related callbacks: [ZIMConversationTotalUnreadMessageCountQueriedCallback].
  • Available since: 2.17.0 and above.
  • Restrictions: There is no limit on the frequency of use; it is available after logging in and not available after logging out.

Return

Callback for conversation total unread message count queried.

updateConversationPinnedState

updateConversationPinnedState
updateConversationPinnedState(isPinned: boolean, conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationPinnedStateUpdatedResult>
Modify the conversation pinned state.

Parameters

NameTypeDescription
isPinnedbooleanWhether the conversation is pinned, true is pinned, false is unpinned.
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type.

Details

This method can modify the pinned state of the specified conversation of the logged-in user.

  • Use cases: You can call this interface when you need to modify the pinned state of a conversation.
  • When to call /Trigger: Can be invoked after login.
  • Related callbacks: [ZIMConversationPinnedStateUpdatedResult].
  • Available since: 2.8.0 and above.
  • Restrictions: Available after login, unavailable after logout.

Return

Callback for updating the pinned state of the conversation.

deleteAllConversations

deleteAllConversations
deleteAllConversations(config: ZIMConversationDeleteConfig): Promise<void>
delete all conversations.

Parameters

NameTypeDescription
configZIMConversationDeleteConfigdelete all conversation's configuration.

Details

This interface is invoked when all conversations needs to be deleted. All members in conversations can invoke this interface.

  • Use cases: If you want to delete all conversations when they are no longer needed, you can call this interface implementation.
  • When to call /Trigger: his parameter is invoked when conversations needs to be deleted and can be invoked after a ZIM instance is created. The call takes effect after login and becomes invalid after logout.
  • Impacts on other APIs: If deleted conversations include unread message will trigger the [conversationTotalUnreadMessageCountUpdated] callback, the call is successful at login, and the other end will trigger [conversationsAllDeleted] callback.
  • Available since: 2.12.0 and above.

Return

Callback of delete conversations result.

deleteConversation

deleteConversation
deleteConversation(conversationID: string, conversationType: ZIMConversationType, config: ZIMConversationDeleteConfig): Promise<ZIMConversationDeletedResult>
delete the conversation.

Parameters

NameTypeDescription
conversationIDstringconversationID.
conversationTypeZIMConversationTypeconversationtype.
configZIMConversationDeleteConfigdelete the session's configuration.

Details

This interface is invoked when a session needs to be deleted. All members in the session can invoke this interface.

  • Use cases: You can invoke this interface implementation to delete an entire session when it is no longer needed.
  • When to call /Trigger: his parameter is invoked when a session needs to be deleted and can be invoked after a ZIM instance is created. The call takes effect after login and becomes invalid after logout.
  • Impacts on other APIs: A successful call triggers the deleteConversation callback. If the deleted conversation contains unread messages, the [onConversationTotalUnreadMessageCountUpdated] callback is triggered.
  • Related callbacks: [ZIMConversationDeletedCallback]
  • Available since: 2.0.0 and above.

Return

Callback of the delete conversation result.

setConversationDraft

setConversationDraft
setConversationDraft(draft: string, conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationDraftSetResult>
Set a conversation draft.

Parameters

NameTypeDescription
draftstringText message draft.
conversationIDstringconversationID.
conversationTypeZIMConversationTypeConversation type. Only Support peer and group conversations

Details

When you need to set a draft for a session, call this interface, and members of the session can call this interface.

  • Use cases: This interface can be invoked when you need to temporarily save the text message that the user is editing but has not yet sent.
  • When to call /Trigger: Call when you need to set session draft, call after creating ZIM instance, take effect after login, invalid after logout.
  • Impacts on other APIs: A successful call triggers the [conversationchanged] callback.
  • Related callbacks: [ZIMConversationDraftSetResult]
  • Available since: 2.14.0 and above.

Return

Callback to set session draft.

clearConversationTotalUnreadMessageCount

clearConversationTotalUnreadMessageCount
clearConversationTotalUnreadMessageCount(): Promise<void>
clear all conversations unreads.

Used to clear unread for all conversations.

  • Use cases: You can call this interface when you need to clear all unread conversations to zero.
  • When to call /Trigger: Called when all conversation readings need to be cleared.
  • Impacts on other APIs: Calling this method will trigger a total readings not updated callback [conversationTotalUnreadMessageCountUpdated].
  • Related APIs: [conversationTotalUnreadMessageCountUpdated].
  • Available since: 2.12.0 and above.
  • Restrictions: Valid after login, invalid after logout.

Callback to remove all conversation unreads result.

clearConversationUnreadMessageCount

clearConversationUnreadMessageCount
clearConversationUnreadMessageCount(conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationUnreadMessageCountClearedResult>
clear session unreads.

Parameters

NameTypeDescription
conversationIDstringconversationID.
conversationTypeZIMConversationTypeconversation type.

Details

Used to clear unread for the current user target session.

  • Use cases: This interface is called when a chat page is entered from a session and the original message readings of the session need to be cleared.
  • When to call /Trigger: Called when a target needs to be cleared without readings.
  • Impacts on other APIs: Calling this method will trigger a total readings not updated callback [conversationTotalUnreadMessageCountUpdated], would trigger a session to update callbacks [conversationChanged].
  • Related callbacks: [ZIMConversationUnreadMessageCountClearedCallback].
  • Related APIs: [conversationTotalUnreadMessageCountUpdated]、[conversationChanged].
  • Available since: 2.0.0 and above.
  • Restrictions: Valid after login, invalid after logout.

Return

Callback of the clear conversation unread message count result.

setConversationMark

setConversationMark
setConversationMark(markType: number, enable: boolean, conversationInfos: const std::vector<ZIMConversationBaseInfo> &): Promise<ZIMConversationMarkSetCallback>
Set or unset conversation marks.

Parameters

NameTypeDescription
markTypenumberMark type. The value range is [1, 20].
enablebooleanTrue is used to set a flag, while false is used to unset a flag.
conversationInfosconst std::vector<ZIMConversationBaseInfo> &List of brief information of conversations that need to be modified conversation tags. Up to 100 conversations can be passed in.

Details

This method can set marks for the conversation.

  • Use cases: When you need to implement custom business logic based on conversation marks.
  • Default value: The conversation marks defaults to empty.
  • When to call: When logged in and a valid conversation exists, if you want to set or unset mark for the target conversation, call this interface.
  • Related callbacks: [ZIMConversationMarkSetCallback]。
  • Available since: 2.17.0 and above.
  • Restrictions: The range for setting marks is [1, 20]. A maximum of 100 conversations are supported for marking at one time.

Return

Callback for setting conversation mark.

setConversationNotificationStatus

setConversationNotificationStatus
setConversationNotificationStatus(status: ZIMConversationNotificationStatus, conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationNotificationStatusSetResult>
Set the conversation notification state.

Parameters

NameTypeDescription
statusZIMConversationNotificationStatusthe session notification state.
conversationIDstringConversation ID. Currently, only "group" conversations and "peer"(only for 2.14.0 or above version) conversations can be set by notification state.
For group conversations, the conversation ID is the group ID.
For single chat conversations, the conversation ID is the user ID of the other party.
conversationTypeZIMConversationTypeconversation type. Currently, only "group" conversations and "peer"(only for 2.14.0 or above version) conversations can be set by notification state.

Details

This method enables DND by selecting whether the unread of the target session is updated when a message is received.

  • Use cases: If the user selects MESSAGE DO not Disturb (DND), the user can call the corresponding method.
  • Default value: Message DND is disabled by default.
  • When to call /Trigger: If the target session exists after login, invoke this interface if you want to enable the DND status of the target session.
  • Impacts on other APIs: After the DND state is enabled, receiving messages is not triggered [conversationTotalUnreadMessageCountUpdated]。
  • Related callbacks: [ZIMConversationNotificationStatusSetResult]。
  • Related APIs: [conversationTotalUnreadMessageCountUpdated]。
  • Available since: 2.0.0 and above.
  • Restrictions: Valid after login, invalid after logout.

Return

Callback of the set conversation notification status result.

cancelSendingMessage

cancelSendingMessage
cancelSendingMessage(message: ZIMMessage, config: ZIMSendingMessageCancelConfig): Promise<void>
Cancels sending of media message.

Parameters

NameTypeDescription
messageZIMMessageThe message to be cancel sending.
configZIMSendingMessageCancelConfigRelated configuration for cancel sending messages.
  • Related APIs: [queryHistoryMessage], [sendMessage].

Return

Callback of the cancel sending result of the message.

editMessage

editMessage
editMessage(message: ZIMMessage, config: ZIMMessageEditConfig, notification: ZIMMessageSendNotification): Promise<ZIMMessageEditedResult>
Edit message.

Parameters

NameTypeDescription
messageZIMMessageThe message to be editing.
configZIMMessageEditConfigRelated configuration for editing messages.
notificationZIMMessageSendNotificationRelated notifications when message is editing.
  • Related APIs: [queryHistoryMessage], [sendMessage].

Return

Callback of the editing result of the message.

pinMessage

pinMessage
pinMessage(message: ZIMMessage, isPinned: boolean, callback: ZIMMessagePinnedCallback): Promise<ZIMMessagePinnedResult>
Pin or unpin message.

Parameters

NameTypeDescription
messageZIMMessageThe message to be pinned or unpinned.
isPinnedbooleanTo pin or unpin.
callbackZIMMessagePinnedCallbackCallback of the result of the message to be pinned or unpinned.
  • Related callbacks: [ZIMMessagePinnedCallback], [onMessagePinStatusChanged].
  • Related APIs: [queryPinnedMessageList], [sendMessage].

Return

Callback of the result of the message to be pinned or unpinned.

sendMessage

sendMessage
sendMessage(message: ZIMMessage, toConversationID: string, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMessageSendNotification): Promise<ZIMMessageSentResult>
send message.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent.
toConversationIDstringThe conversation ID the message needs to be sent.
conversationTypeZIMConversationTypeConversation type, supports single chat, room and group chat.
configZIMMessageSendConfigRelated configuration for sending messages.
notificationZIMMessageSendNotificationRelated notifications when messages are sent.
  • Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages],[sendMediaMessage].

sendMediaMessage

sendMediaMessage
sendMediaMessage(message: ZIMMediaMessage, toConversationID: string, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, notification: ZIMMediaMessageSendNotification): Promise<ZIMMediaMessageSentResult>
Send media messages.

Parameters

NameTypeDescription
messageZIMMediaMessageWhen using the message to be sent, modify the type of message according to the type of multimedia message. For example, when sending image messages, use ZIMImageMessage.
toConversationIDstringThe conversation ID of the message recipient, supports single chat, room and group chat.
conversationTypeZIMConversationTypeConversation type, supports single chat, room and group chat.
configZIMMessageSendConfigRelated configuration for sending messages.
notificationZIMMediaMessageSendNotificationRelevant notifications when sending media messages, including upload progress, etc.
  • Impacts on other APIs: Using this method will trigger the [receivePeerMessage] / [receiveRoomMessage] / [receiveGroupMessage] callback of the message receiver, and will trigger the [conversationChanged] callback of the sender and receiver. Fires the [conversationTotalUnreadMessageCountUpdated] callback.

pushconfig only needs to be filled in when you need to use the offline push function. Sending media messages to the room does not support offline push, nor does it support the callbacks [conversationChanged] and [conversationTotalUnreadMessageCountUpdated].

  • Related callbacks: [ZIMMessageSentResult], [ZIMMediaUploadingProgress], [receivePeerMessage], [receiveRoomMessage], [receiveGroupMessage], [conversationChanged], [conversationTotalUnreadMessageCountUpdated].
  • Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages]

Return

Result for sending media messages.

insertMessageToLocalDB

insertMessageToLocalDB
insertMessageToLocalDB(message: ZIMMessage, conversationID: string, conversationType: ZIMConversationType, senderUserID: string): Promise<ZIMMessageInsertedResult>
Insert a message to the local DB.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent.
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type.
senderUserIDstringThe sender ID of this message.

Details

This method can insert a message directly to the local DB on the client side.

  • Use cases: The developer can combine the system message type, and convert the callback notification (for example, invite someone into the group, remove someone from the group, etc.) to the system message type on the client side and insert it into the local DB to achieve the effect of the system prompt .
  • When to call: It can be called after login.
  • Caution: Inserting "command" messages is not supported. To insert a "room" message, upgrade the SDK to 2.13.0 and above.
  • Related callbacks: [ZIMMessageInsertedCallback].
  • Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages].
  • Available since: 2.4.0 and above.

Return

The result of the inserted message.

sendConversationMessageReceiptRead

sendConversationMessageReceiptRead
sendConversationMessageReceiptRead(conversationID: string, conversationType: ZIMConversationType): Promise<ZIMConversationMessageReceiptReadSentResult>
Sets all received receipts for the conversation as read.

Parameters

NameTypeDescription
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type, only Peer type is supported.

Details

Set all received receipts of the conversation to be read.

  • Use cases: Set all received receipt messages in the entire conversation to be read, and the sender of the message receipt in the conversation will receive the [onConversationMessageReceiptChanged] callback from ZIMEventHandler.
  • When to call: It can be called after login. It is recommended to call before entering the message list page. In the message list page, it is recommended to call [sendMessageReceiptsRead] to batch set the messages that need to be read.
  • Caution: Only single chat conversation are allowed.

Related callback: [ZIMConversationMessageReceiptReadSentCallback].

  • Related APIs: [sendMessageReceiptsRead], [sendMessage].
  • Available since: 2.5.0 and above.

Return

Set Conversation read callback.

sendMessageReceiptsRead

sendMessageReceiptsRead
sendMessageReceiptsRead(messageList: ZIMMessage[], conversationID: string, conversationType: ZIMConversationType): Promise<ZIMMessageReceiptsReadSentResult>
Set the receipt of a batch of messages to become read.

Parameters

NameTypeDescription
messageListZIMMessage[]The list of messages to be read with no more than 10 messages.
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type.

Details

This method can set the receipt of a batch of messages to become read.

  • Use cases: Developers can use this method to set a batch of messages with receipts that have been read. If the sender is online, it will receive the [onMessageReceiptChanged] callback.
  • When to call: Callable after login. It is recommended to set the settings for the messages that need to be read on the message list page. It is not recommended to mix with [sendConversationMessageReceiptRead].
  • Related callbacks: [ZIMMessageReceiptsReadSentCallback].
  • Related APIs: [sendMessage].
  • Available since: 2.5.0 and above.
  • Restrictions: Only support the settings for received messages with receipt status as PROCESSING.

Return

Set the result callback of the read message.

queryMessageReceiptsInfo

queryMessageReceiptsInfo
queryMessageReceiptsInfo(messageList: ZIMMessage[], conversationID: string, conversationType: ZIMConversationType): Promise<ZIMMessageReceiptsInfoQueriedResult>
Query the receipt information of a batch of messages.

Parameters

NameTypeDescription
messageListZIMMessage[]list of messages to query.
conversationIDstringConversation ID.
conversationTypeZIMConversationTypeConversation type.

Details

This method can query the receipt information of a batch of messages, including the status, the number of unread users and the number of read users.

  • Use cases: If you need to query the receipt status of the message, the number of unread users and the number of read users, you can call this interface.
  • When to call: Callable after login. If you need to query the detailed member list, you can query through the interface [queryGroupMessageReceiptReadMemberList] or [queryGroupMessageReceiptUnreadMemberList].
  • Related callbacks: [ZIMMessageReceiptsInfoQueriedResult].
  • Related APIs: [queryGroupMessageReceiptReadMemberList] , [queryGroupMessageReceiptUnreadMemberList].
  • Available since: 2.5.0 and above.
  • Restrictions: Only messages whose statuses are not 0 are supported.

Return

Callback for the result of querying message receipt information.

queryGroupMessageReceiptReadMemberList

queryGroupMessageReceiptReadMemberList
queryGroupMessageReceiptReadMemberList(message: ZIMMessage, groupID: string, config: ZIMGroupMessageReceiptMemberQueryConfig): Promise<ZIMGroupMessageReceiptMemberListQueriedResult>
Query the list of read members of the group

Parameters

NameTypeDescription
messageZIMMessagelist of messages to query.
groupIDstringGroup ID.
configZIMGroupMessageReceiptMemberQueryConfigquery configuration.

Details

This method can query the specific read member list of a message sent by a group.

  • Use cases: Developers can use this method to query the specific read member list of a message they send.
  • When to call: Callable after login.
  • Related callbacks: [ZIMGroupMessageReceiptMemberListQueriedCallback].
  • Related APIs: If you need to query the receipt status of a certain message or only need to query the read/unread count, you can query through the interface [queryMessageReceiptsInfo].
  • Available since: 2.5.0 and above.
  • Restrictions: only supports querying the messages sent by the local end, and the receipt status of the messages is not NONE. If the user is not in the group, or has been kicked out of the group, the corresponding member list cannot be found.

Return

Query the result callback of the specific read member list.

queryGroupMessageReceiptUnreadMemberList

queryGroupMessageReceiptUnreadMemberList
queryGroupMessageReceiptUnreadMemberList(message: ZIMMessage, groupID: string, config: ZIMGroupMessageReceiptMemberQueryConfig): Promise<ZIMGroupMessageReceiptMemberListQueriedResult>
Query the list of read members of the group.

Parameters

NameTypeDescription
messageZIMMessageMessage to query
groupIDstringGroup ID.
configZIMGroupMessageReceiptMemberQueryConfigquery configuration

Details

This method can query the specific unread member list of a message sent by a group.

  • Use cases: Developers can use this method to query the specific unread member list of a message they send.
  • When to call: Callable after login.
  • Related callbacks: [ZIMGroupMessageReceiptMemberListQueriedCallback].
  • Related APIs: If you need to query the receipt status of a certain message or only need to query the read/unread count, you can query through the interface [queryMessageReceiptsInfo].
  • Available since: 2.5.0 and above.
  • Restrictions: only supports querying the messages sent by the local end, and the receipt status of the messages is not NONE. If the user is not in the group, or has been kicked out of the group, the corresponding member list cannot be found.

Return

Query the result callback of the specific read member list.

searchLocalMessages

searchLocalMessages
searchLocalMessages(conversationID: string, conversationType: ZIMConversationType, config: ZIMMessageSearchConfig): Promise<ZIMMessagesSearchedResult>
Search local message list.

Parameters

NameTypeDescription
conversationIDstringThe conversation ID of the local message to be search.
conversationTypeZIMConversationTypeconversation type.
configZIMMessageSearchConfigSearch the configuration of local messages.
  • Related callbacks: [ZIMMessagesSearchedResult].
  • Restrictions: Effective after login, invalid after logout. Searching is not supported in the room scene (conversationType=1).

Return

Callback of the search local message result.

searchLocalConversations

searchLocalConversations
searchLocalConversations(config: ZIMConversationSearchConfig): Promise<ZIMConversationsSearchedResult>
Search local conversations on local messages.

Parameters

NameTypeDescription
configZIMConversationSearchConfigGlobal search conversation config.
  • Related callbacks: [ZIMConversationsSearchedResult].
  • Restrictions: effective after logging in and becomes invalid after logging out. Searching is not supported in room scenarios (conversationType=1).

Return

Callback of the search conversations message result.

searchGlobalLocalMessages

searchGlobalLocalMessages
searchGlobalLocalMessages(config: ZIMMessageSearchConfig): Promise<ZIMMessagesGlobalSearchedResult>
Search global local message list.

Parameters

NameTypeDescription
configZIMMessageSearchConfigSearch global the configuration of local messages.
  • Related callbacks: [ZIMMessagesGlobalSearchedResult].
  • Restrictions: Effective after login, invalid after logout. Searching global is not supported in the room scene (conversationType=1).

Return

Callback of the search global local message result.

replyMessage

replyMessage
replyMessage(message: ZIMMessage, toOriginalMessage: ZIMMessage, config: ZIMMessageSendConfig, notification: ZIMMessageSendNotification): Promise<ZIMMessageSentResult>
send reply message.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent. Only supports: ZIMTextMessage(1), ZIMImageMessage(11), ZIMFileMessage(12), ZIMAudioMessage(13), ZIMVideoMessage(14), ZIMCombineMessage(100), ZIMCustomMessage(200)."
toOriginalMessageZIMMessageThe source message to be quoted. Only supports: ZIMTextMessage(1), ZIMImageMessage(11), ZIMFileMessage(12), ZIMAudioMessage(13), ZIMVideoMessage(14), ZIMCombineMessage(100), ZIMCustomMessage(200)."
configZIMMessageSendConfigRelated configuration for sending messages.
notificationZIMMessageSendNotificationRelated notifications when messages are sent.
  • Related APIs: [queryHistoryMessage], [sendMessage], [sendMediaMessage].

queryMessageRepliedList

queryMessageRepliedList
queryMessageRepliedList(message: ZIMMessage, config: ZIMMessageRepliedListQueryConfig): Promise< ZIMMessageRepliedListQueriedResult >
Query the reply list.

Parameters

NameTypeDescription
messageZIMMessageAny message in the reply list.
configZIMMessageRepliedListQueryConfigquery configuration

Details

Query the reply message list.

  • Use cases: Developers can use this method to query the entire reply message tree.
  • When to call: Callable after login.
  • Available since: 2.17.0 and above.

Return

The query result callback.

sendMediaMessage

sendMediaMessage
sendMediaMessage(message: ZIMMediaMessage, toConversationID: string, conversationType: ZIMConversationType, config: ZIMMessageSendConfig, progress: ZIMMediaUploadingProgress): Promise<ZIMMediaMessageSentResult>
Send media messages.

Parameters

NameTypeDescription
messageZIMMediaMessageThe message to be sent.
toConversationIDstringThe conversation ID of the message recipient, supports single chat, room and group chat.
conversationTypeZIMConversationTypeConversation type, supports single chat, room and group chat.
configZIMMessageSendConfigRelated configuration for sending messages.
progressZIMMediaUploadingProgressProgress callback for sending media messages.

Details

Supported versions: 2.1.0 and above.

Detailed description: This method can be used to send messages in single chat, room and group chat.

Business scenario: When you need to send media to the target user, target message room, and target group chat after logging in, send it through this interface.

Call timing/Notification timing: It can be called after login.

Usage limit: no more than 10/s, available after login, unavailable after logout.

Impact: [onReceivePeerMessage]/[ReceiveGroupMessage] sessions and session-scoped [onReceiveGroupMessage] sessions did not fire message receiver's [ConversationR] fires [onversationTotalUnreadMessageCountUpdated] objection.

Only required if you need to use the threaded update feature when pushing configuration. Push notifications are not supported, nor are [onContationChanged] and [ConTotalUnreadMessageCountUpdated] supported if media messages are broadcast to the world.

Related: [ZIMMessageSentCallback], [ZIMMediaUploadingProgress], [onReceivePeMessage], [onReceiveRoomMessage], [onReceiveGroupMessage], [onConversationChanged], [onConversationTotalUnreadMessageCountUpdated].

Related interfaces: [queryHistoryMessage], [deleteAllMessage], [deleteMessages]

Return

Result for sending media messages.

sendPeerMessage

sendPeerMessage
deprecated
sendPeerMessage(message: ZIMMessage, toUserID: string, config: ZIMMessageSendConfig): Promise<ZIMMessageSentResult>
Send peer-to-peer messages.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent.
toUserIDstringThe ID of the user who will receive the message.
configZIMMessageSendConfigRelated configuration for sending single chat messages.

Details

After this function is called, a message is sent to the specified user.

  • Use cases: This function is used in 1V1 chat scenarios.
  • Available since: 1.1.0 or above.
Deprecated
This API has been deprecated since 2.4.0, use [sendMessage] instead.

Return

Callback of the sending result of the message.

sendRoomMessage

sendRoomMessage
deprecated
sendRoomMessage(message: ZIMMessage, toRoomID: string, config: ZIMMessageSendConfig): Promise<ZIMMessageSentResult>
Send room messages.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent.
toRoomIDstringThe ID of the room which will receive the message.
configZIMMessageSendConfigRelated configuration for sending room messages.

Details

When this function is called, the message will be sent in the room.

Use Cases: This feature is required for scenarios where multiple people in the room are chatting.

  • Available since: 1.1.0 or above
Deprecated
This API has been deprecated since 2.4.0, use [sendMessage] instead.

Return

Callback of the sending result of the message.

sendGroupMessage

sendGroupMessage
deprecated
sendGroupMessage(message: ZIMMessage, toGroupID: string, config: ZIMMessageSendConfig): Promise<ZIMMessageSentResult>
Send group messages.

Parameters

NameTypeDescription
messageZIMMessageThe message to be sent.
toGroupIDstringThe ID of the user who will receive the message.
configZIMMessageSendConfigRelated configuration for sending single chat messages.

Details

This interface is invoked when a group chat message needs to be sent.

Service scenario: This interface can be used when sending group messages.

Call timing/Notification timing: This interface is called when a group chat message needs to be sent.

Usage restrictions: No more than 10 pieces /s, available after login, unavailable after logout.

pushconfig is only required to use the offline push function.

Scope of influence: Using this method triggers the receivePeerMessage callback of the message recipient and the onConversationChanged callback of the sender and receiver. If messages are not set for the session where the message resides, Trigger conversationTotalUnreadMessageCountUpdated callback.

The callback: [ZIMMessageSentResult], [receiveGroupMessage], [conversationChanged], [conversationTotalUnreadMessageCountUpdated].

Relevant interface: [queryHistoryMessage], [deleteMessage].

Deprecated
This API has been deprecated since 2.4.0, use [sendMessage] instead.

Return

Callback of the sending result of the message.

queryHistoryMessage

queryHistoryMessage
queryHistoryMessage(conversationID: string, conversationType: ZIMConversationType, config: ZIMMessageQueryConfig): Promise<ZIMMessageQueriedResult>
Query historical messages.

Parameters

NameTypeDescription
conversationIDstringThe session ID of the queried historical message.
conversationTypeZIMConversationTypeconversation type.
configZIMMessageQueryConfigQuery the configuration of historical messages.
  • Related callbacks: [ZIMMessageQueriedCallback].
  • Restrictions: Effective after login, invalid after logout. In the default room scenario (conversationType=1), offline message is disabled. If you need to enable it, please contact the corresponding technical support.

Return

Callback of the query history message result.

queryPinnedMessageList

queryPinnedMessageList
queryPinnedMessageList(conversationID: string, conversationType: ZIMConversationType, callback: ZIMMessageQueriedCallback): Promise<ZIMMessageQueriedResult>
Query pinned message list.

Parameters

NameTypeDescription
conversationIDstringThe conversation ID of the queried pinned message.
conversationTypeZIMConversationTypeconversation type.
callbackZIMMessageQueriedCallbackReturns the result of querying historical messages.
  • Related callbacks: [ZIMPinnedMessageListQueriedCallback].
  • Restrictions: The SDK must be logged in and the message pinning feature must be supported to use this interface.

Return

Callback of the query pinned message result.

queryMessages

queryMessages
queryMessages(messageSeqs: number[], conversationID: string, conversationType: ZIMConversationType): Promise< ZIMMessageQueriedResult>
Query messages based on the message seq list.

Parameters

NameTypeDescription
messageSeqsnumber[]The message seq list to be queried.
conversationIDstringThe conversation ID of the queried message.
conversationTypeZIMConversationTypeconversation type.

Details

Supported versions: 2.17.0 and above.

Detailed description: Query a batch of messages based on the message seq list.

Business scenario: Jump to the source message location quoted by the reply message on the chat page.

Return

Returns the result of querying messages.

deleteAllConversationMessages

deleteAllConversationMessages
deleteAllConversationMessages(config: ZIMMessageDeleteConfig): Promise<void>
Delete all messages for all sessions.

Parameters

NameTypeDescription
configZIMMessageDeleteConfigDelete the configuration of the message.
  • Impacts on other APIs: Call the interface trigger [onMessageDeleted] callback, if there are unread messages at this time, will trigger [onConversationTotalUnreadMessageCountUpdated] callback.
  • Related callbacks: [ZIMConversationMessagesAllDeletedCallback]、[onMessageDeleted]、[onConversationTotalUnreadMessageCountUpdated].
  • Restrictions: Effective after login.

Return

Return the result of deleting all messages for all conversations.

queryCombineMessageDetail

queryCombineMessageDetail
queryCombineMessageDetail(message: ZIMCombineMessage): Promise<ZIMCombineMessageDetailQueriedResult>
query combine message detail

Parameters

NameTypeDescription
messageZIMCombineMessageThe combine message needs querying message list.
  • Use cases: If you need to obtain the specific sub-messages under the combine message, you can call this API to query.
  • Restrictions: You can only use it after logging in.

Return

Returns the result of querying combine message detail.

revokeMessage

revokeMessage
revokeMessage(message: ZIMMessage, config: ZIMMessageRevokeConfig): Promise<ZIMMessageRevokedResult>
revoke message.

Parameters

NameTypeDescription
messageZIMMessageThe message needs to be revoke.
configZIMMessageRevokeConfigRevoke the configuration of the message.
  • Use cases: The user needs to recall a message. This method can be used when the user does not want other users to see the message.
  • When to call: Called when the message needs to be revoked.

Room message revoke is not supported.

  • Related callbacks: If the revoked message is the latest message of the session, the [conversationChanged] callback will be triggered, and if the message is unread, the [conversationTotalUnreadMessageCountUpdated] callback will be triggered.
  • Restrictions: Login is required to use. To revoke messages from other members within the group, the group owner needs to use version 2.9.0 or above.

Return

Returns the result of revoking the message.

deleteMessages

deleteMessages
deleteMessages(messageList: ZIMMessage[], conversationID: string, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig): Promise<ZIMMessageDeletedResult>
delete message.

Parameters

NameTypeDescription
messageListZIMMessage[]List of deleted messages.
conversationIDstringThe session ID of the deleted message.
conversationTypeZIMConversationTypeconversation type.
configZIMMessageDeleteConfigDelete the configuration of the message.
  • Impacts on other APIs: If the deleted message is the latest message of the session, the [conversationChanged] callback will be triggered, and if the message is unread, the [conversationTotalUnreadMessageCountUpdated] callback will be triggered.
  • Related callbacks: [ZIMMessageDeletedCallback]、[conversationChanged]、[conversationTotalUnreadMessageCountUpdated].
  • Restrictions: Effective after login.

Return

Returns the result of deleting the message.

addMessageReaction

addMessageReaction
addMessageReaction(reactionType: string, message: ZIMMessage): Promise<ZIMMessageReactionAddedResult>
add message reaction

Parameters

NameTypeDescription
reactionTypestringType of reaction, defined by you, with a maximum length of 32 bytes.
messageZIMMessageThe message needs reaction.
  • Use cases: Users need to express their position on a certain message, such as liking, and this method can be used to express their position.

Room message reaction is not supported.

  • Related callbacks: If the addition is successful, the [messageReactionsChanged] callback will be triggered. If the reaction is made to the latest message in the conversation, the [conversationChanged] callback will be triggered when the addition is successful.
  • Restrictions: You can only use it after logging in. And only supports message statements for single chat and group chat

Return

Returns the result of adding reaction.

deleteMessageReaction

deleteMessageReaction
deleteMessageReaction(reactionType: string, message: ZIMMessage): Promise<ZIMMessageReactionDeletedResult>
delete message reaction

Parameters

NameTypeDescription
reactionTypestringReaction type. It must be the type of reaction made by the local user.
messageZIMMessageThe message needs reaction delete.
  • Use cases: Users need to delete the status of a message that has already been stated, which can be done using this method.

Room message reaction is not supported.

  • Related callbacks: If the deletion is successful, the [messageReactionsChanged] callback will be triggered. If the reaction is deleted from the latest message in the conversation, the [conversationChanged] callback will be triggered when the deletion is successful.
  • Restrictions: You can only use it after logging in. And only supports message statements for single chat and group chat

Return

Returns the result of deleting reaction.

queryMessageReactionUserList

queryMessageReactionUserList
queryMessageReactionUserList(message: ZIMMessage, config: ZIMMessageReactionUserQueryConfig): Promise<ZIMMessageReactionUserListQueriedResult>
query message reaction userlist

Parameters

NameTypeDescription
messageZIMMessageThe message needs querying reaction user list.
configZIMMessageReactionUserQueryConfigreaction user query config.
  • Use cases: When it is necessary to obtain specific user information under a certain state of a message, this interface can be called to query state user messages in a paginated manner.
  • Restrictions: You can only use it after logging in. And only supports message statements for single chat and group chat

Return

Returns the result of querying reaction user list.

deleteAllMessage

deleteAllMessage
deleteAllMessage(conversationID: string, conversationType: ZIMConversationType, config: ZIMMessageDeleteConfig): Promise<ZIMMessageDeletedResult>
Delete all message.

Parameters

NameTypeDescription
conversationIDstringThe session ID of the message to be deleted.
conversationTypeZIMConversationTypeconversation type.
configZIMMessageDeleteConfigdelete session configuration.
  • Impacts on other APIs: The [conversationChanged] callback is triggered, and if there are unread messages, the [conversationTotalUnreadMessageCountUpdated] callback is triggered.
  • Related callbacks: [ZIMMessageDeletedCallback].
  • Restrictions: Effective after login, invalid after logout.

The impact of deleting messages is limited to this account, and messages from other accounts will not be deleted.

Return

Returns the result of deleting the message.

updateMessageLocalExtendedData

updateMessageLocalExtendedData
updateMessageLocalExtendedData(localExtendedData: string, message: ZIMMessage): Promise<ZIMMessageLocalExtendedDataUpdatedResult>
Update the local expandable field of the message.

Parameters

NameTypeDescription
localExtendedDatastringThe expandable message field visible only on this end can store additional information locally and currently has a length limit of 128K. If you have special requirements, please contact ZEGO technical support for configuration.
messageZIMMessageMessage body to be updated

Details

After the user logs in, calling this interface allows updating the local expandable field of the message.

  • When to call: After the user is logged in.
  • Privacy reminder: Please avoid passing sensitive personal information, including but not limited to phone numbers, ID card numbers, passport numbers, real names, etc.
  • Related callbacks: [ZIMMessageLocalExtendedDataUpdatedResult ].
  • Available since: 2.9.0 or above.

Return

The result of the update user extended data.

queryRoomMembers

queryRoomMembers
queryRoomMembers(userIDs: string[], roomID: string): Promise<ZIMRoomMembersQueriedResult>
Query the information of up to ten users in the specified room.

Parameters

NameTypeDescription
userIDsstring[]List of user IDs to query.
roomIDstringThe room ID of the specified room.

Details

This method can query the information of up to ten users in the specified room of the logged-in user.

  • Use cases: When you need to know the user information in the specified room, you can call this interface to obtain the data source.
  • When to call /Trigger: Can be invoked after login.
  • Available since: 2.8.0 and above.
  • Restrictions: Available after login, unavailable after logout, up to ten users can be queried at one time.

Return

Callback for querying room user information.

setRoomMembersAttributes

setRoomMembersAttributes
setRoomMembersAttributes(attributes: Record<string, string>, userIDs: string[], roomID: string, config: ZIMRoomMemberAttributesSetConfig): Promise<ZIMRoomMembersAttributesOperatedResult>
Set room member attributes (use this for all additions and changes).

Parameters

NameTypeDescription
attributesRecord<string, string>Room member attributes to be set.
userIDsstring[]A list of userIDs to set.
roomIDstringRoom ID.
configZIMRoomMemberAttributesSetConfigBehavior configuration of the operation.

Details

Supported Versions: 2.4.0 and above.

Detail description: Call this API to set room user properties of members in the room.

Business scenario: If you need to set a level for members in the room, you can use this interface to set a state.

Default: [ZIMRoomMemberAttributesSetConfig] Default constructor isDeleteAfterOwnerLeft is true.

Call timing: After logging in and calling in the relevant room.

Usage limit: A maximum of 500 user attributes can be set in each room and stored in the key-value mode. If you need to increase the attribute limit, please contact ZEGO technical support. The total length of user attribute key-values owned by each user in a room cannot exceed 144 bytes, and the number of key-values cannot exceed 30 pairs. The length of a single key-value cannot exceed 8 bytes for a Key and 64 bytes for a Value. If you need to raise the cap, please contact ZEGO technical support. After the room is destroyed, the user-defined user properties are also destroyed.

Relevant callback: [ZIMRoomMembersAttributesOperatedResult],[roomMemberAttributesUpdated].

Related interfaces: [queryRoomMembersAttributesByUserIDs], [queryRoomMemberAttributesList].

Return

Operation result for setting room members attributes.

queryRoomMembersAttributes

queryRoomMembersAttributes
queryRoomMembersAttributes(userIDs: string[], roomID: string): Promise<ZIMRoomMembersAttributesQueriedResult>
Batch query the room user attributes of the members in the room.

Parameters

NameTypeDescription
userIDsstring[]A list of userIDs to query.
roomIDstringRoom ID.

Details

Call this API to batch query the room user attributes of the members in the room.

  • Use cases: Use this interface when you need to specify that you want to query some room users.
  • Related callbacks: [ZIMRoomMembersAttributesQueriedResult].
  • Related APIs: [setRoomMembersAttributes]、[queryRoomMemberAttributesList].
  • Runtime lifecycle: It is available after logging in and joining the corresponding room, but unavailable after leaving the corresponding room.
  • Available since: 2.4.0 or later.
  • Restrictions: The maximum call frequency is 5 times within 30 seconds by default, and the maximum query time is 100 people.

Return

The result of batch query of room user attributes.

queryRoomMemberAttributesList

queryRoomMemberAttributesList
queryRoomMemberAttributesList(roomID: string, config: ZIMRoomMemberAttributesQueryConfig): Promise<ZIMRoomMemberAttributesListQueriedResult>
paginate the room user properties that have room property members in the room.

Parameters

NameTypeDescription
roomIDstringRoom ID.
configZIMRoomMemberAttributesQueryConfigBehavior configuration of the operation.

Details

paginate the room user properties that have room property members in the room.

  • Use cases: This interface is used when you need to query all room users.
  • Related callbacks: [ZIMRoomMemberAttributesListQueriedResult].
  • Related APIs: [setRoomMembersAttributes]、[queryRoomMembersAttributes].
  • Runtime lifecycle: It is available after logging in and joining the corresponding room, but unavailable after leaving the corresponding room.
  • Available since: 2.4.0 or later.
  • Restrictions: The maximum call frequency is 5 times within 30 seconds by default, and the maximum query time is 100 people.

Return

Result of paging query for room user properties.

createRoom

createRoom
createRoom(roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig): Promise<ZIMRoomCreatedResult>
Create a room with advanced settings

Parameters

NameTypeDescription
roomInfoZIMRoomInfoThe configuration information of the room to be created.
configZIMRoomAdvancedConfigThe advanced properties of the room to be created.

Details

Users can create and join rooms through this api, other users can join this room through [joinRoom] function.

  • Available since: 1.3.0.

Return

Callback of the result of creating the room.

enterRoom

enterRoom
enterRoom(roomInfo: ZIMRoomInfo, config: ZIMRoomAdvancedConfig): Promise<ZIMRoomEnteredResult>
Enter the room. If the room does not exist, it will be created automatically.

Parameters

NameTypeDescription
roomInfoZIMRoomInfoConfiguration information for the room that will be created. Only the first user who enters the room creates roomName and takes effect.
configZIMRoomAdvancedConfigAdvanced properties of the room that will be created. Only the first user who enters the room is configured to take effect.
  • When to call: It can be called after logging in.

When everyone leaves the room, the room will be automatically destroyed, and a user can be in a maximum of 5 rooms at the same time. [enterRoom] is equivalent to [createRoom] and [joinRoom], so you only need to choose one of the APIs.

  • Related callbacks: The result of entering the room can be obtained through the [onRoomEntered] callback.
  • Related APIs: You can enter the room through [enterRoom], and leave the room through [leaveRoom].

Return

Callback of the result of entering the room.

switchRoom

switchRoom
switchRoom(fromRoomID: string, toRoomInfo: ZIMRoomInfo, isCreateWhenRoomNotExisted: boolean, config: ZIMRoomAdvancedConfig): Promise<ZIMRoomSwitchedResult>
Switch from one room to another. If the room does not exist, it will decide whether to create the corresponding room based on the passed parameters.

Parameters

NameTypeDescription
fromRoomIDstringConfiguration information for the room that will be created. Only the first user who enters the room creates roomName and takes effect.
toRoomInfoZIMRoomInfoBasic information of the room to be switched to. The roomName field is only valid when the room to be switched to does not exist and the isCreateWhenRoomNotExisted field is true.
isCreateWhenRoomNotExistedbooleanWhen the room to be switched to does not exist, decide whether to create the corresponding room based on this field.
configZIMRoomAdvancedConfigIf the isCreateWhenRoomNotExisted field is true and the room to be switched to does not exist, create the room advanced property configuration used by the corresponding room.
  • When to call: It can be called after logging in.
  • Related callbacks: The result of switching the room can be obtained through the [ZIMRoomSwitchedResult].

Return

Callback of the result of switching the room.

joinRoom

joinRoom
joinRoom(roomID: string): Promise<ZIMRoomJoinedResult>
Join a room.

Parameters

NameTypeDescription
roomIDstringID of the room to join.

Details

If the room does not exist, the join fails and you need to call [createRoom] to create the room first.

  • Use cases: In a multi-person chat scenario, users can call this interface to enter the room when they need to join the room.
  • When to call: It can be called after creating a ZIM instance through [create].
  • Caution: When everyone leaves the room, the room will be automatically destroyed.
  • Related APIs: You can create a room with [createRoom] and leave the room with [leaveRoom].
  • Available since: 1.1.0 or above.

Return

Callback of the result of joining the room

leaveRoom

leaveRoom
leaveRoom(roomID: string): Promise<ZIMRoomLeftResult>
Leave a room.

Parameters

NameTypeDescription
roomIDstringID of the room to leave.

Details

When the user in the room needs to leave the room, use [leaveRoom] to leave the room. If the room does not exist, the leave fails.

  • Use cases: In the multi-person chat scenario, when users in the room need to leave the room, they can leave the room through this interface.
  • When to call: After creating a ZIM instance via [create], it can be called when the user is in the room.
  • Caution: If the current user is not in this room, the exit fails. When everyone leaves the room, the room will be automatically destroyed.
  • Related APIs: You can create a room through [createRoom] and join a room with [joinRoom].
  • Available since: 1.1.0 or above.

Return

Callback of the result of leave the room.

leaveAllRoom

leaveAllRoom
leaveAllRoom(): Promise<ZIMAllRoomLeftResult>
Leave all rooms entered.

Call this interface to exit all rooms you have entered at once.

  • When to call: Can be called after logging in.
  • Related callbacks: Get the list of rooms left through [ZIMAllRoomLeftResult].
  • Available since: 2.15 and above.

Callback for the results of leaving all rooms.

queryRoomMemberList

queryRoomMemberList
queryRoomMemberList(roomID: string, config: ZIMRoomMemberQueryConfig): Promise<ZIMRoomMemberQueriedResult>
Query the list of members in the room.

Parameters

NameTypeDescription
roomIDstringID of the room to query.
configZIMRoomMemberQueryConfigConfiguration of query room member operation.

Details

After joining a room, you can use this function to get the list of members in the room.

  • Use cases: When a developer needs to obtain a list of room members for other business operations, this interface can be called to obtain a list of members.
  • When to call: After creating a ZIM instance through [create], and the user is in the room that needs to be queried, you can call this interface.
  • Caution: To use this feature, please contact ZEGOCLOUD technical support. If the user is not currently in this room, the query fails. When there are more than 500 room members, the result of querying the list of room members can only contain the information of a maximum of 500 members.
  • Related APIs: You can check the online number of people in the room through [queryRoomOnlineMemberCount].
  • Available since: 1.1.0 or above.

Return

Callback for the result of querying room members list.

queryRoomOnlineMemberCount

queryRoomOnlineMemberCount
queryRoomOnlineMemberCount(roomID: string): Promise<ZIMRoomOnlineMemberCountQueriedResult>
Query the number of online members in the room.

Parameters

NameTypeDescription
roomIDstringID of the room to query.

Details

After joining a room, you can use this function to get the number of online members in the room.

  • Use cases: When a developer needs to obtain the number of room members who are online, this interface can be called.

Calling time: After creating a ZIM instance through [create], and the user is in the room that needs to be queried, this interface can be called.

  • Caution: If the user is not currently in this room, the query will fail.
  • Related APIs: the room member can be inquired through [queryRoomMember].
  • Available since: 1.1.0 or above.

Return

Callback for the result of querying room online members count.

queryRoomAllAttributes

queryRoomAllAttributes
queryRoomAllAttributes(roomID: string): Promise<ZIMRoomAttributesQueriedResult>
Query all properties of the room.

Parameters

NameTypeDescription
roomIDstringNeed to query the room number of the custom attributes.

Details

Used to query room attributes.

  • Available since: 1.3.0.

Return

Callback for querying room attributes.

setRoomAttributes

setRoomAttributes
setRoomAttributes(roomAttributes: Record<string, string>, roomID: string, config: ZIMRoomAttributesSetConfig): Promise<ZIMRoomAttributesOperatedResult>
Set room attributes (use this for all additions and changes).

Parameters

NameTypeDescription
roomAttributesRecord<string, string>Room attributes to be set.
roomIDstringTo modify the room number of the room attribute.
configZIMRoomAttributesSetConfigBehavior configuration of the operation.

Details

Used to set room properties.

  • Use cases: This interface is used when you need to set the mic bit in a chat room.
  • When to call /Trigger: after login, and in the relevant room to call.
  • Default value: [ZIMRoomAttributesSetConfig] the space-time of the default configuration is optional, and do not update the owner, and involves the room properties in the owner is not automatically deleted after exit.
  • Privacy reminder: Try not to introduce sensitive information related to personal privacy into the property of the room, including but not limited to mobile phone number, ID number, passport number, real name, etc.

Privacy reminder: Adds or modifies room properties to an existing room.

  • Related callbacks: [ZIMRoomAttributesOperatedCallback].
  • Related APIs: [DeleteRoomAttributes] to delete room attributes. [QueryRoomAllAttributes], queries the room attributes.
  • Available since: 1.3.0.
  • Restrictions: You can set a maximum of 20 properties per room.

Notice: Key-value of the room property. The default key length is 16 and the default value length is 1024.

Return

Operation callback for setting room properties.

deleteRoomAttributes

deleteRoomAttributes
deleteRoomAttributes(keys: string[], roomID: string, config: ZIMRoomAttributesDeleteConfig): Promise<ZIMRoomAttributesOperatedResult>
Delete room attributes.

Parameters

NameTypeDescription
keysstring[]The key of the room attribute to be deleted.
roomIDstringTo modify the room number of the room attribute
configZIMRoomAttributesDeleteConfigBehavior configuration of the operation.

Details

Used to delete room attributes.

  • Available since: 1.3.0.

Return

Operation callback for setting room properties.

beginRoomAttributesBatchOperation

beginRoomAttributesBatchOperation
beginRoomAttributesBatchOperation(roomID: string, config: ZIMRoomAttributesBatchOperationConfig): void
Open combination room attribute operation.

Parameters

NameTypeDescription
roomIDstringThe number of the room where the combined operation needs to be turned on.
configZIMRoomAttributesBatchOperationConfigThe configuration of the combined operation.

Details

Used to turn on the combination of room attributes.

  • Available since: 1.3.0.

endRoomAttributesBatchOperation

endRoomAttributesBatchOperation
endRoomAttributesBatchOperation(roomID: string): Promise<ZIMRoomAttributesBatchOperatedResult>
Complete the property operation of the combined room.

Parameters

NameTypeDescription
roomIDstringTo modify the room number of the room attribute.

Details

After completing the operation of combining room attributes, all the setting/deleting operations from the last call to beginRoomAttributesBatchOperation to this operation will be completed for the room.

  • Available since: 1.3.0.

Return

Callback for combined operation.

ZPNs

Details

ZPNs SDK main class.

Methods

getInstance

static
getInstance
getInstance(): ZPNs
Get the ZPNs instance.

Get the ZPNs instance.

  • Use cases: This method is used to obtain ZPNs singletons when ZPNs is used.
  • Available since: 2.3.0 or later.

ZPNs instance.

register

register
register(config: ZPNsConfig, zim: ZIM): void
This method is used to register vendor offline push.

Parameters

NameTypeDescription
configZPNsConfigOffline push configuration object.
zimZIMZIM instance, ZIM SDK requires version 2.3.0 or above.

Details

This method is used to register Google FCM offline push.

  • Use cases: This method is called when a developer needs to use offline push.
  • Available since: ZPNs 2.3.0 or later.

unregister

unregister
unregister(): void
Call this method to de-register when offline push is not required.

Call this method to de-register when offline push is not required.

  • When to call /Trigger: Called when de-registration is required.
  • Caution: It needs to be called after [register] is called.
  • Available since: 2.3.0 or later.

Previous

Function Overview

Next

Interface

On this page

Back to top