API Overview

Last updated: 2020-03-12 14:44:07


Here, APIs refer to the cross-platform C APIs of IM.

Download URLs for different platforms:

Callbacks are classified into two types. One is async callbacks that call an API, and the other is notifications pushed by the backend. A callback is triggered by the internal logic thread of the IM SDK, which may be different from the thread that calls the API.
In Windows, if a UI message loop has been created before the API TIMInit is called to initialize the IM SDK and the thread that calls the API TIMInit is a main UI thread, the IM SDK throws callbacks to the main UI thread for calling.

If the parameter string of an API contains Chinese characters, it must be encoded in UTF-8.

Event callback APIs

API Description
TIMAddRecvNewMsgCallback Adds the callback for receiving a new message.
TIMRemoveRecvNewMsgCallback Sets the callback for deleting a newly received message.
TIMSetMsgReadedReceiptCallback Sets the callback for setting the message read receipt.
TIMSetMsgRevokeCallback Sets the callback for recalling a received message.
TIMSetMsgElemUploadProgressCallback Sets the callback for checking the progress of uploading files pertaining to message elements.
TIMSetGroupTipsEventCallback Sets the callback for delivering a group system message.
TIMSetConvEventCallback Sets the callback for triggering a conversation event.
TIMSetNetworkStatusListenerCallback Sets the callback for monitoring the network connection status.
TIMSetKickedOfflineCallback Sets the callback for receiving a forcible logout notification.
TIMSetUserSigExpiredCallback Sets the callback for ticket expiration.
TIMSetOnAddFriendCallback Sets the callback for adding a friend.
TIMSetOnDeleteFriendCallback Sets the callback for deleting a friend.
TIMSetUpdateFriendProfileCallback Sets the callback for updating a friend’s profile.
TIMSetFriendAddRequestCallback Sets the callback for friend requests.
TIMSetLogCallback Sets the callback for logs.
TIMSetMsgUpdateCallback Sets the callback for the message update notification that is returned after a message is modified in the cloud.

Initialization APIs of the IM SDK

API Description
TIMInit Initializes the IM SDK.
TIMUninit Uninstalls the IM SDK.
TIMGetSDKVersion Obtains the IM SDK version number.
TIMSetConfig Sets extra user configurations.

Login and logout APIs

API Description
TIMLogin Logs in to the IM backend server.
TIMLogout Logs out from the IM backend server.

Conversation APIs

API Description
TIMConvCreate Creates a conversation.
TIMConvDelete Deletes a conversation.
TIMConvGetConvList Obtains the locally cached conversation list.
TIMConvSetDraft Sets the draft for a specified conversation.
TIMConvCancelDraft Deletes the draft for a specified conversation.

Message APIs

API Description
TIMMsgSendNewMsg Sends a new message.
TIMMsgReportReaded Reports the read state of messages.
TIMMsgRevoke Recalls a message.
TIMMsgFindByMsgLocatorList Accurately locates a message of the specified conversation by using the message locator.
TIMMsgImportMsgList Imports the message list to a specified conversation.
TIMMsgSaveMsg Saves custom messages.
TIMMsgGetMsgList Obtains the message list of a specified conversation.
TIMMsgDelete Deletes the messages of a specified conversation.
TIMMsgDownloadElemToPath Downloads the internal elements (including image, video, audio, and file elements) of a message to a specified path.
TIMMsgBatchSend Sends messages in batches.

Group APIs

API Description
TIMGroupCreate Creates a group.
TIMGroupDelete Deletes (dismisses) a group.
TIMGroupJoin Submits an application for joining a group.
TIMGroupQuit Quits a group.
TIMGroupInviteMember Invites a user to a group.
TIMGroupDeleteMember Deletes a member from a group.
TIMGroupGetJoinedGroupList Obtains the list of groups that a user has joined.
TIMGroupGetGroupInfoList Obtains the group information list.
TIMGroupModifyGroupInfo Modifies group information.
TIMGroupGetMemberInfoList Obtains the group member information list.
TIMGroupModifyMemberInfo Modifies group member information.
TIMGroupGetPendencyList Obtains the pending request list of a group.
A pending request refers to an operation that has not yet been processed. For example, if an invitation to a user to join a group or a request from a user to join a group has not been accepted or rejected, the invitation is a pending request for the group.
TIMGroupReportPendencyReaded Reports the read state of pending requests of a group.
TIMGroupHandlePendency Handles the pending requests of a group.

User profile APIs

API Description
TIMProfileGetUserProfileList Obtains a specified user profile list.
TIMProfileModifySelfUserProfile Modifies your own profile.

Relationship chain APIs

API Description
TIMFriendshipGetFriendProfileList Obtains the friend list.
TIMFriendshipAddFriend Adds a friend.
TIMFriendshipHandleFriendAddRequest Handles friend requests.
TIMFriendshipModifyFriendProfile Updates a friend’s profile (such as remarks).
TIMFriendshipDeleteFriend Deletes a friend.
TIMFriendshipCheckFriendType Checks the friend type (one-way or two-way).
TIMFriendshipCreateFriendGroup Creates a friend group.
TIMFriendshipGetFriendGroupList Obtains the group information of a specified friend group.
TIMFriendshipModifyFriendGroup Modifies a friend group.
TIMFriendshipDeleteFriendGroup Deletes a friend group.
TIMFriendshipAddToBlackList Adds a specified user to the blacklist.
TIMFriendshipGetBlackList Obtains the blacklist.
TIMFriendshipDeleteFromBlackList Deletes a specified user from the blacklist.
TIMFriendshipGetPendencyList Obtains the information list of pending friend requests.
TIMFriendshipDeletePendency Deletes the specified pending friend request information.
TIMFriendshipReportPendencyReaded Reports the read state of the pending friend request information.