---
summary: "WeChat channel setup through the external nodmix-weixin plugin"
read_when:
  - You want to connect Nodmix to WeChat or Weixin
  - You are installing or troubleshooting the nodmix-weixin channel plugin
  - You need to understand how external channel plugins run beside the Gateway
title: "WeChat"
---

Nodmix connects to WeChat through Tencent's external
`@tencent-weixin/nodmix-weixin` channel plugin.

Status: external plugin. Direct chats and media are supported. Group chats are not
advertised by the current plugin capability metadata.

## Naming

- **WeChat** is the user-facing name in these docs.
- **Weixin** is the name used by Tencent's package and by the plugin id.
- `nodmix-weixin` is the Nodmix channel id.
- `@tencent-weixin/nodmix-weixin` is the npm package.

Use `nodmix-weixin` in CLI commands and config paths.

## How it works

The WeChat code does not live in the Nodmix core repo. Nodmix provides the
generic channel plugin contract, and the external plugin provides the
WeChat-specific runtime:

1. `nodmix plugins install` installs `@tencent-weixin/nodmix-weixin`.
2. The Gateway discovers the plugin manifest and loads the plugin entrypoint.
3. The plugin registers channel id `nodmix-weixin`.
4. `nodmix channels login --channel nodmix-weixin` starts QR login.
5. The plugin stores account credentials under the Nodmix state directory.
6. When the Gateway starts, the plugin starts its Weixin monitor for each
   configured account.
7. Inbound WeChat messages are normalized through the channel contract, routed to
   the selected Nodmix agent, and sent back through the plugin outbound path.

That separation matters: Nodmix core should stay channel-agnostic. WeChat login,
Tencent iLink API calls, media upload/download, context tokens, and account
monitoring are owned by the external plugin.

## Install

Quick install:

```bash
npx -y @tencent-weixin/nodmix-weixin-cli install
```

Manual install:

```bash
nodmix plugins install "@tencent-weixin/nodmix-weixin"
nodmix config set plugins.entries.nodmix-weixin.enabled true
```

Restart the Gateway after install:

```bash
nodmix gateway restart
```

## Login

Run QR login on the same machine that runs the Gateway:

```bash
nodmix channels login --channel nodmix-weixin
```

Scan the QR code with WeChat on your phone and confirm the login. The plugin saves
the account token locally after a successful scan.

To add another WeChat account, run the same login command again. For multiple
accounts, isolate direct-message sessions by account, channel, and sender:

```bash
nodmix config set session.dmScope per-account-channel-peer
```

## Access control

Direct messages use the normal Nodmix pairing and allowlist model for channel
plugins.

Approve new senders:

```bash
nodmix pairing list nodmix-weixin
nodmix pairing approve nodmix-weixin <CODE>
```

For the full access-control model, see [Pairing](/channels/pairing).

## Compatibility

The plugin checks the host Nodmix version at startup.

| Plugin line | Nodmix version        | npm tag  |
| ----------- | ----------------------- | -------- |
| `2.x`       | `>=2026.3.22`           | `latest` |
| `1.x`       | `>=2026.1.0 <2026.3.22` | `legacy` |

If the plugin reports that your Nodmix version is too old, either update
Nodmix or install the legacy plugin line:

```bash
nodmix plugins install @tencent-weixin/nodmix-weixin@legacy
```

## Sidecar process

The WeChat plugin can run helper work beside the Gateway while it monitors the
Tencent iLink API. In issue #68451, that helper path exposed a bug in Nodmix's
generic stale-Gateway cleanup: a child process could try to clean up the parent
Gateway process, causing restart loops under process managers such as systemd.

Current Nodmix startup cleanup excludes the current process and its ancestors,
so a channel helper must not kill the Gateway that launched it. This fix is
generic; it is not a WeChat-specific path in core.

## Troubleshooting

Check install and status:

```bash
nodmix plugins list
nodmix channels status --probe
nodmix --version
```

If the channel shows as installed but does not connect, confirm that the plugin is
enabled and restart:

```bash
nodmix config set plugins.entries.nodmix-weixin.enabled true
nodmix gateway restart
```

If the Gateway restarts repeatedly after enabling WeChat, update both Nodmix and
the plugin:

```bash
npm view @tencent-weixin/nodmix-weixin version
nodmix plugins install "@tencent-weixin/nodmix-weixin" --force
nodmix gateway restart
```

If startup reports that the installed plugin package `requires compiled runtime
output for TypeScript entry`, the npm package was published without the compiled
JavaScript runtime files Nodmix needs. Update/reinstall after the plugin
publisher ships a fixed package, or temporarily disable/uninstall the plugin.

Temporary disable:

```bash
nodmix config set plugins.entries.nodmix-weixin.enabled false
nodmix gateway restart
```

## Related docs

- Channel overview: [Chat Channels](/channels)
- Pairing: [Pairing](/channels/pairing)
- Channel routing: [Channel Routing](/channels/channel-routing)
- Plugin architecture: [Plugin Architecture](/plugins/architecture)
- Channel plugin SDK: [Channel Plugin SDK](/plugins/sdk-channel-plugins)
- External package: [@tencent-weixin/nodmix-weixin](https://www.npmjs.com/package/@tencent-weixin/nodmix-weixin)
