WeChat mini program SDK
Add chat to mini programs in WeChat and WeCom: sign-in, one-to-one and group chat, friends, chat rooms, message sync, files and voice recording, plus tools that bind the data to your pages. The API matches the Web SDK; media and lifecycle are adapted to what mini programs can do.

| Item | Details |
|---|---|
| Current version | 1.1.1 (Versions and support) |
| Base library | 2.21.3 or later |
| Hosts | WeChat and WeCom; not QQ, Alipay, Douyin and others |
| Audio and video | No real-time calls; standalone RTC channels are query-only |
Install the published SDK
Install it in your mini program project, then run "Build npm" in WeChat DevTools:
npm install @deeprespond/im-miniprogram@1.1.1In the DevTools project settings, add miniprogram_npm/@deeprespond/** to setting.babelSetting.ignore; the SDK is already compiled and doesn't need transpiling again.
| Your project | Package to use |
|---|---|
| Native mini program | @deeprespond/im-miniprogram (prebuilt, no runtime dependencies) |
| Taro React | @deeprespond/im-web/miniprogram + @deeprespond/im-web-react/miniprogram; import @deeprespond/im-web/polyfills first |
| SDK in a subpackage | Import /bind in the main package and set the reference with createDRClientRef once the client loads |
Configure trusted domains
Add these addresses to the server domains in the mini program admin console:
| Type | Address |
|---|---|
| request | The IM service's HTTPS address and the object storage upload address |
| socket | The IM service's WSS address |
| downloadFile | The file download address |
If you use the photo album or microphone, also declare those privacy APIs in the admin console.
Mini program requests can't use PATCH, so the SDK sends POST with X-HTTP-Method-Override: PATCH instead. The IM service supports this; if you run your own gateway in between, let this header through.
What you can build
| Feature | Docs |
|---|---|
| Creating the client, sign-in, page data binding, a chat page | Quickstart, pages and media |
| Conversations, messages, friends, groups, chat rooms | Same as the Web SDK: Conversations, Messages, Groups, Chat rooms |
| Streaming AI bot replies | AI replies |
| Standalone RTC channels (query only) | RTC channel queries and limits |
Differences from the web
- Files are sent and received by path; Blob isn't supported. The local image cache defaults to 50 MiB, and a single download is limited to 200 MiB.
- On phones, WeChat pauses the connection about 4 seconds after going to the background and restores it in the foreground; WeChat on desktop doesn't disconnect in the background.
- User data is isolated by app, user and API address; where encrypted storage isn't available, the SDK warns and falls back to normal storage.
Build from source
When you want to change the SDK or run the examples in the repository:
cd sdk/web && pnpm install --frozen-lockfile && pnpm build
cd ../..
make sdk-miniprogram-test
make sdk-miniprogram-example
cd sdk/miniprogram
pnpm pack --out /tmp/im-miniprogram.tgzInstall the generated tgz in your project and run "Build npm" again. The repository has native, subpackage, TypeScript and Taro examples; see the Demo guide.
Next steps
- Quickstart, pages and media: create the client, sign in and build a chat page.
- Demo guide: native and Taro examples.
- Versions and support: what's been verified and the known limits.
