Home / Technical articles / Agent

Agent

Three ways to connect an agent to WeCom — and when to use which

Custom apps, group bots and H5 pages — the three integration methods differ completely in permissions, capabilities and scenarios.

Bottom line first

· Need employees to “ask questions as if chatting” in WeCom → in-house app (bot)

· Need to push notifications or alerts with no interaction → group-robot webhook

· Need a complex interface (tables, charts, approval flows) → embed an H5 page in WeCom

They are not substitutes: one project often uses two or even three of them.

Option 1: a custom-built app (recommended as the main entry point)

Create a custom app in the WeCom admin console and configure the callback URL for receiving messages; when a user sends a message, WeCom pushes it to your service.

Advantage: user identity (WeCom userid) is available for permission control; supports rich text, images and files; messages can be pushed proactively.

Drawback: you must handle message encryption and decryption (WeCom callbacks are encrypted), expose a publicly reachable callback URL, and meet reply deadlines (typically respond within 5 seconds; for long tasks reply “processing” first and push the result asynchronously).

Good for: agent Q&A, ticket submission, query-type operations.

Option 2: group bot webhook (lightest)

Add a bot to the group chat, get its webhook URL, and POST a message to that URL to post into the group.

Advantage: a webhook can be wired up in five minutes with no callback exposed on your server; supports text, Markdown and rich-media cards.

Drawback: one-way — it can send but not receive (the bot cannot receive user replies), and it cannot push to individuals, only to the group.

Good for: alert notifications, daily report pushes, task reminders. Not suitable for interactive agents.

Option 3: embedded H5 page

Embed the web page in the WeCom workspace so users open your app with one click.

Advantage: no UI constraints — tables, charts and approval flows are all possible; user identity is available through the JS-SDK.

Drawback: you must configure trusted domains and JS interface security domains; the experience is inferior to native and load times depend on the network.

Good for: scenarios that need complex UI operations, such as filling in forms, viewing reports and approvals.

How to combine the three

Taking equipment maintenance as an example:

· An employee asks the in-house app in WeCom “the projector in Hall 3 won't light up” → the app handles it

· The agent gives troubleshooting advice → answered right in the conversation

· If a service call is needed → push it to the maintenance group via a group-robot webhook

· Maintenance staff tap the link in the message → an H5 page opens to submit the repair request

One scenario used three methods, each doing what it does best.

A few easy pitfalls

Pitfall 1: the callback URL must be public HTTPS, and a trusted domain must be configured in the WeCom admin console. Intranet deployments need a reverse proxy layer.

Pitfall 2: message callbacks are retried, so if your service responds slowly WeCom pushes the same message again. Handle it idempotently (deduplicate by msgid).

Pitfall 3: a custom app needs its visible scope configured; without it employees cannot see the app and assume it never launched.

Pitfall 4: the JS-SDK signature for H5 pages must be generated by the backend — the front end cannot compute it itself, or you get signature errors.

← All articles Talk through your scenario