OpenIM Mini Program SDK overview
Understand Mini Program SDK use cases, runtime differences, and unavailable local search and clearing APIs.
The OpenIM Mini Program SDK is designed for Mini Programs and lightweight Web scenarios. Its method-level models for users, conversations, messages, groups, and events are consistent with other OpenIMClientSDKs. However, it does not provide local message storage or several search and clearing APIs that depend on a local database. Follow the WASM SDK documentation for shared capabilities. This page covers only runtime differences and unavailable APIs.
Relationship to WASM
- Follow the corresponding WASM guide for method semantics, events, and data models.
- Differences are limited to the initialization entry point, domain allowlists, file selection and uploads, platform lifecycle, and the unavailable APIs listed below.
- A Web client that needs a complete local message database, conversation cache, and persistent history should use the WASM SDK instead.
Unavailable APIs (Compared to WASM SDK)
The Mini Program SDK currently omits the following methods. You can implement full-text search and conversation history purging on your business backend, or page through available query endpoints and filter records in-memory.
| Unavailable API | WASM Reference | Recommended Alternative |
|---|---|---|
clearConversationAndDeleteAllMsg | Clear conversation messages | Manage history purging via backend policies or custom APIs; update the local UI view accordingly. |
searchLocalMessages | Search messages | Search via backend search indexes, then locate the conversation by returned conversationID and clientMsgID. |
searchFriends | Search friends | Fetch friends via paginated queries and filter locally, or query your organizational directory service. |
searchGroupMembers | Search group members | Use Get group member list to filter locally, or search via backend services. |
searchGroups | Search groups | Page through joined groups and filter in-memory, or implement backend group discovery. |
findMessageList | Find messages by ID | Cache message IDs in session state, then fetch surrounding conversation context using available message query APIs. |
Core Shared Capabilities (Refer to WASM SDK)
| Domain | WASM Entry Point |
|---|---|
| Authentication | Authenticate and manage a session |
| Getting Started | Integrate by runtime environment and Send your first message |
| Users | User overview |
| Conversations | Conversation overview |
| Groups | Group overview |
| Messages | Message overview |
| Events | Event overview |
Runtime Considerations
- Configure authorized domain allowlists (covering HTTP request, WebSocket connection, and file upload endpoints) in the Mini Program developer console before deployment.
- Since the SDK is optimized for environments without a local database, your application does not need to handle local offline storage. When the Mini Program resumes or a view is restored, fetch the latest conversation and message snapshots on demand.
- When sending file or media messages, adapt to the target platform's file pickers, temporary file path conventions, and package size limitations.
- Authentication tokens must be securely issued by your application backend and strictly match the provided
userID. - In standard web browsers, this pure JavaScript SDK is recommended only for lightweight widgets or temporary customer service chats. For production-grade web messaging applications requiring offline persistence and local caching, use the WASM SDK instead.
Was this page helpful?