Repository navigation
Description
repo:objectstack#4 · os-elon-musk · session_016WV4cxgb3PKFkt8y5FigJn
Research card requested by the maintainer (one card, no sub-cards); drafted by an independent fable-model review against main. Route (first-party channel vs bridges, #27314), edition split and build go-ahead are the maintainer's decision. Sibling: Teams research #35668.
Research only: no code, no ADR text and no ruling is changed by this card. Read on objectstack-ai/objectstack main at d96c878e and on branch claude/area-a4W-34730 (ADR-0013 addendum draft, tier commit 73a678ad on top of 509987bf). Every Tencent-side statement below comes from the public WeCom developer documentation as the author remembers it, not from a live test against a corp; section 6 lists what to verify before any estimate is treated as a commitment.
维护者速读
- 要什么:审批和 AI 待确认操作等通知,按每个人的设置,以企业微信「应用消息」送到本人,和 Slack 私信(notifications: a Slack messaging channel with per-person binding — the org installs a Slack app once, each person's notifications arrive as Slack DMs (ADR-0013 / ADR-0022 / ADR-0030) #34730)同一套设计。
- 好消息:企业微信的 access_token 换取、缓存、提前失效重试,平台已经有了(ADR-0143 的
app-credential,vendorwecom)。通知管线、偏好、免打扰、重试也都是现成的。 - 缺什么:企业微信通道本身、回调接口(验签 + AES 解密)、人员绑定、管理员配置页、测试和文档。Slack 卡要建的两张表(组织安装、人员绑定)企业微信直接复用,不重复计。
- 工作量:社区版部分约 20–37 人日(前提是 Slack 卡的公共部分先落地;否则 33–58)。企业版部分约 25–43 人日,另有腾讯侧的服务商注册、审核、域名备案,按周计,不是开发工作量。
- 必须先拍板的一点:[Epic] Bridges — vendor suites (DingTalk, WeCom, Feishu) behind the standard protocols the platform speaks: the platform's generic interfaces (webhook channel, inbound webhook, OIDC, SCIM) and the objectstack-ai/bridges repository #27314 已裁定「钉钉、企业微信、飞书走中转服务(bridge),不做代码插件」,该专题目前暂停。本卡按 Slack 的做法(平台内置通道)估算,和那条裁定方向不同,需要你选一条路。
- 版本建议:和 Slack 裁定一致。社区版:企业自建应用 + 每组织安装一次 + 人员绑定确认一次;企业版:托管的服务商应用一键安装、托管凭据、账号健康、多企业管理。
1. Goal
Deliver platform notifications to one person as a WeCom app message (应用消息, sent by an application to a member, the WeCom equivalent of a Slack DM from a bot): approval requests, reminders and outcomes first, AI pending actions once a producer emits them. Same shape as the Slack design ruled on #34730: the organization installs an app once, each person is linked to their WeCom member id and confirms the link once, messages go to the person only (no group chats), the person's preferences, digest and quiet hours decide whether a message is sent, and a person with no confirmed link keeps getting inbox and email exactly as today. The message carries a deep link back to the request; deciding from inside the chat is listed as an optional item, not as parity.
2. Route question that has to be answered first
Two records point in different directions for WeCom:
- [Epic] Bridges — vendor suites (DingTalk, WeCom, Feishu) behind the standard protocols the platform speaks: the platform's generic interfaces (webhook channel, inbound webhook, OIDC, SCIM) and the objectstack-ai/bridges repository #27314 (Epic: Bridges), decision 1, 2026-10-28: vendor suites without a standard API — DingTalk, WeCom, Feishu are named — integrate through bridges in
objectstack-ai/bridges, not through code plugins; the platform gains generic interfaces once (B1: a per-recipientwebhookmessaging channel over the existing HTTP outbox). Decision 3: hosted ObjectOS Cloud loads no code plugins. The epic ispm:on-hold(2026-11-08) and p3 (2026-11-16); no child was filed. - notifications: a Slack messaging channel with per-person binding — the org installs a Slack app once, each person's notifications arrive as Slack DMs (ADR-0013 / ADR-0022 / ADR-0030) #34730 rulings (2026-11-19): Slack becomes a first-party
slackMessagingChannelinside@objectstack/service-messaging, delegating transport toconnector-slack, withsys_channel_accountandsys_channel_user_linkin the framework.
This card estimates the #34730 route (a first-party wecom channel in the framework), because that is what "parity with the Slack design" means and because the shared tables then serve both. A first-party framework package is not a third-party code plugin in the #27108 sense, so decision 3 is not touched, but decision 1 names WeCom explicitly, so building this needs the maintainer to say that per-person notifications for WeCom follow the Slack route. Section 5 gives the delta for the bridge route. The objectstack-ai/bridges repository was not readable from this session, so what its kit already holds (the epic says a token cache landed at 80b4abd) is unverified.
3. What exists today
Reused as is
| What | Where | Note |
|---|---|---|
| WeCom token exchange, cache and refresh | packages/services/service-automation/src/oauth2-grant/app-credential.ts (the WECOM exchange, createAppCredentialHandle, retryOnVendorTokenRefusal); schema ConnectorAppCredentialVendorSchema in packages/spec/src/shared/connector-auth.zod.ts |
gettoken with corpid + secret, in-memory cache with skew margin, single flight, refresh once on errcode 40014 / 42001, the token as the access_token query parameter, no URL or vendor text in errors (the secret rides in the URL). This is the "access_token caching/refresh" item, already built and tested for self-built apps. It does not cover the service-provider token chain (suite ticket, suite token, corp token). |
| Channel seam | packages/services/service-messaging/src/channel.ts (MessagingChannel: send, classifyError, isAvailable) |
A new channel is one implementation of this interface. |
| Channel registration | packages/services/service-messaging/src/messaging-service-plugin.ts (registerChannelProvider + lazyChannelMount, used for email, sms, push) |
The channel is mounted while its transport is resolvable. |
| Closest model to copy | packages/services/service-messaging/src/sms-channel.ts (335 lines) and push-channel.ts (340 lines) |
Recipient resolution, per-recipient locale, template render, transport_not_configured refusal. |
| Outbox, retry, dead letter, cluster dispatch | dispatcher.ts, sql-outbox.ts, backoff.ts in the same package |
Free for any registered channel. |
| Preferences, digest, quiet hours | preference-resolver.ts, my-preferences-routes.ts; sys_notification_preference keys on topic × channel |
A wecom channel id joins with no schema change. getKnownChannels() already reports configured: true/false per channel to the settings page. |
| Personal Notification Settings page | #34728 (closed, shipped) | The connect/disconnect row attaches here. |
| Templates | template-renderer.ts, registerBuiltinTemplates; approval pattern in packages/plugins/plugin-approvals/src/approval-email-templates.ts |
(topic, channel, locale) rendering, 11 locales for approvals. |
| Approval notifications | packages/plugins/plugin-approvals/src/approval-service.ts emits approval.requested, .reminder, .approved, .rejected, .returned, .reassigned, .escalated, .request_info, .comment, .sla_breached, .ooo_* with actionUrl and (for emailed topics) an absolute approvalUrl built from public-base-url.ts |
The deep link a WeCom card needs is already computed. |
| Session-less decision pages | packages/plugins/plugin-approvals/src/action-link-pages.ts (ADR-0043) |
Written for "an email or IM message"; bilingual EN / 中文. |
| Secret storage at rest | Field.secret() through the host ICryptoProvider, as used by sys_connector_credential (packages/services/service-automation/src/sys-connector-credential.object.ts) |
The pattern for storing corpsecret, callback Token and EncodingAESKey. |
| Inbound signature precedent | packages/triggers/trigger-api/src/declared-signature.ts, packages/core/src/security/http-signature.ts |
Timing-safe verification and replay-window conventions to follow; WeCom's SHA1 + AES scheme itself is new. |
| Admin UI precedent | ui/packages/app-shell/src/views/setup/ConnectorCredentialsPage.tsx, CredentialValueForm.tsx, ConnectorConnectionsPage.tsx |
Write-only secret form and connection status listing. |
Does not exist
- No WeCom, DingTalk or Feishu channel code anywhere.
grepfor wecom / weixin / dingtalk / feishu / lark outside ADRs and docs finds only the connector auth vendor above. NotificationChannelSchema(packages/spec/src/system/notification.zod.ts) listsslackandteamsbut notwecom; none of the three has a delivery implementation.sys_channel_accountandsys_channel_user_linkare not declared in code (ADR-0012's "seam reserved" was never built).- No callback receiver for any chat vendor; ADR-0013's receiver sub-system is Draft and unbuilt.
- A connector instance and its credential are environment-level (
sys_connector_credentialhas no organization column; per-organization credentials on a shared environment were ruled not supported, S1 on [Decision] Where a customer administrator supplies a declarative connector credential: a platform credentials page over an encrypted object, an app-shipped settings manifest, env-only as today, or the OAuth connection record #27230). So the existingapp-credentialinstance cannot by itself be "one install per org"; the per-org row has to besys_channel_account, feedingcreateAppCredentialHandlewith that row's corpid and secret. - Producers name their channels:
approval-service.tssends emailed topics to['inbox', 'email']and everything else defaults to['inbox'](messaging-service.ts,requestedChannels). Nothing today would route an approval to a chat channel even if one were registered. - No notification is emitted for an AI pending action in this repository. The contract (
packages/spec/src/contracts/ai-service.ts) says the item is shown in the conversation and the inbox; nomessaging.emitsite and no topic exist for it here, and the AI service implementation is outside this repo.
Shared with #34730 — lands once for all chat channels, not counted in this card
| Shared item | Why WeCom needs it | Rough size inside #34730 |
|---|---|---|
sys_channel_account object and its install door (one row per org per channel, secret fields, status) |
The org's corpid / agentid / secret / callback keys live here | 3–5 d |
sys_channel_user_link object and the propose-then-confirm flow, including who may unbind (still open on #34730) |
WeCom userid per platform user | 4–6 d |
| The rule by which a chat channel joins an emit that named only inbox / email (preference-driven opt-in versus producers listing channels) | Without it no approval reaches any chat channel | 2–3 d |
| Connect / disconnect section on the Notification Settings page | WeCom adds one row to it | 1–2 d |
| A notification producer and topic for AI pending actions | Same for every channel; partly outside this repo | not sized here |
The sizes are this card's estimate of the shared part, given only to compute the saving in section 5; #34730 owns them.
4. Work items
Effort is engineer-days, low–high, and assumes the shared items above have landed with #34730. It includes the unit tests each item needs; cross-cutting tests and docs are their own rows. "Free" means open tier.
| # | Item | Package / files | Tier | Effort | Depends on |
|---|---|---|---|---|---|
| W1 | ADR-0013 addendum for WeCom: install model (self-built app = self-hosted own app; service-provider app = hosted one app), binding method, destination (app message to one member), reconciliation with #27314 | docs/adr/0013-bidirectional-messaging.md, ADR index |
free | 1–2 | route ruling (section 2) |
| W2 | Transport: message send, userid lookups, error-code mapping. A small connector-wecom (or a declarative openapi instance) exposing message/send, user/getuserid, user/get_userid_by_email; WeCom answers HTTP 200 with errcode, so map codes to ErrorClass (invalid member, rate limited, IP not trusted, token refused, system busy) and read invaliduser from a partly failed send |
new packages/connectors/connector-wecom/; reuses oauth2-grant/app-credential.ts |
free | 2–4 | W1 |
| W3 | The wecom MessagingChannel: resolve the recipient through the confirmed link, per-org isAvailable, render, send as text card or template card with a link button to the absolute deep link, classify errors; add wecom to NotificationChannelSchema and the preference options |
packages/services/service-messaging/src/wecom-channel.ts, messaging-service-plugin.ts, preference-options.ts, packages/spec/src/system/notification.zod.ts |
free | 2–4 | W2, shared account + link |
| W4 | Message templates for the approval topics on channel wecom in the 11 approval locales, within WeCom's field length limits; plain-text fallback |
packages/plugins/plugin-approvals/src/ (new template file beside approval-email-templates.ts), approval-service.ts |
free | 1–2 | W3 |
| W5 | Callback endpoint per account: URL verification (decrypt echostr), msg_signature SHA1 check, AES-256-CBC decrypt with the EncodingAESKey, receive-id check, replay window, fast acknowledge. Needed even for send-only use if it is the precondition for setting the trusted IP (see section 6) |
new receiver in packages/services/service-messaging/src/ (route + crypto module) |
free | 3–5 | shared account |
| W6 | Person binding, WeCom side: propose by email lookup, then by mobile (sys_user.phone_number), ambiguous or missing proposes nothing; "Connect WeCom" through WeCom web authorization as the path that always works (the person proves both identities, which is the confirmation); state and CSRF handling |
packages/services/service-messaging/src/ (proposer + OAuth callback route) |
free | 3–6 | W2, shared link store |
| W7 | Admin setup page: corpid, agentid, secret, callback Token and EncodingAESKey (write-only), shows the callback URL to paste and the egress IPs to allow, "send me a test message", readable error for an untrusted IP | ui/packages/app-shell/src/views/setup/ (new page beside ConnectorCredentialsPage.tsx) |
free | 1.5–3 | shared account door |
| W8 | WeCom row on the personal Notification Settings page: proposed link, confirm, connect, disconnect, status | ui/packages/app-shell/src/ settings page from #34728 |
free | 0.5–1 | W6, shared section |
| W9 | Egress: a fixed outbound address for WeCom calls on self-hosted deployments (proxy setting for this transport) and a documented way to learn the address | connector-wecom, deployment docs |
free | 1–2 | W2 |
| W10 | Tests: approval request reaches the linked member with a deep link; muted or quiet hours sends nothing; unlinked person gets inbox and email only; callback crypto against Tencent's published vectors; padding and signature negative cases; platform checklist item; one dogfood pass against a real corp | packages/services/service-messaging/src/*.test.ts, packages/plugins/plugin-approvals/src/*.integration.test.ts, docs/qa/platform-checklist/ |
free | 3–5 | W3–W8 |
| W11 | Docs: setup walkthrough (create the self-built app, visible range, callback, trusted IP), troubleshooting by error code, changeset, release note | content/docs/, docs/adr/README.md |
free | 1.5–3 | W7 |
| W12 | Optional, beyond Slack parity: decide inside the chat — button-interaction template card, template_card_event callback, decision recorded as the linked person, card updated in place. Needs its own ruling on acting without a session (ADR-0043 covers a token link, not a chat callback) |
wecom-channel.ts, receiver, plugin-approvals |
free if built | 5–8 | W5, W6, a ruling |
| E1 | Hosted service-provider app (第三方应用): suite credentials, command callback (suite ticket every ten minutes, authorize / change / cancel / reset-permanent-code events), suite token cache shared across nodes, pre-auth code and one-click install link, permanent code exchange, per-corp token from the permanent code, data callback where the receive id is the customer corpid, encrypted userid handling | cloud repository (hosted half), plus a provider-token variant next to app-credential.ts |
enterprise | 12–20 | W2, W3, W5, Tencent registration |
| E2 | Managed credentials and vault: suite secret and each corp's permanent code in the vault backend, rotation on reset-permanent-code | cloud; vault backend | enterprise | 3–5 (1–2 if the Slack vault work landed) | E1 |
| E3 | Account health: periodic probe, watch for cancel-auth, untrusted IP, expired licence and refused token, status on the account row, admin alert | cloud + service-messaging status fields |
enterprise | 3–5 (1.5–3 after Slack's) | E1 |
| E4 | Multi-corp management: N corps on the one hosted app, one org linked to several corps, uninstall and re-authorize lifecycle, routing by corp | cloud + sys_channel_account lifecycle |
enterprise | 4–7 | E1 |
| E5 | China hosting for the hosted app: callback ingress on an ICP-filed domain, fixed egress addresses registered with Tencent, data-flow statement (member ids and message text go to Tencent; what the message may contain) | cloud deployment config, docs | enterprise | 3–6, plus calendar time outside engineering | E1 |
| E6 | Contingent: interface-licence handling (接口调用许可) if Tencent requires per-member licences for service-provider apps — order, activation and expiry | cloud | enterprise | 0, or 5–10 | verification in section 6 |
Not proposed: the "代开发" (provider-built custom app) shape. It sits between the two — per-corp like a self-built app, but registered and reviewed under the provider — and adds a third install path with its own review step. Recommend skipping it unless the service-provider listing proves unobtainable.
5. Totals
| Part | Engineer-days |
|---|---|
| Free part, W1–W11, with #34730's shared items already landed | about 20–37 (sum 19.5–37) |
| Free part if WeCom went first and had to build the shared items and pattern itself | about 33–58 |
| Saving from #34730 landing first | about 13–21 (the shared tables, binding flow, channel-joining rule and settings section, 10–16; plus the channel, admin-page and test patterns, 3–5) |
| Optional W12 (decide in chat) | 5–8 |
| E1 hosted service-provider app | 12–20 |
| E2 managed credentials / vault | 3–5 |
| E3 account health | 3–5 |
| E4 multi-corp management | 4–7 |
| E5 China hosting | 3–6 |
| Enterprise total, E1–E5 | about 25–43, plus 5–10 if E6 applies |
| Overall, free + enterprise, without W12 and E6 | about 45–80 |
Calendar items that are not engineering effort and can dominate the hosted schedule: service-provider registration and app review at Tencent, and ICP filing for the callback domain — weeks each, sequence unknown until tried.
Bridge route delta (if #27314 decision 1 stands for WeCom): W3 is replaced by the generic B1 webhook channel (small, serves every vendor); W2, W5 and the WeCom half of W6 move to objectstack-ai/bridges with similar size; the shared sys_channel_user_link is replaced by the epic's SCIM externalId mapping, which is Enterprise-only today (the epic's open decision 2) and has no confirm-once step; a self-hosted org runs one more service. The engineering total is of the same order; what changes is where the code lives, the binding model, and that the Slack ruling's "confirm once" would not carry over without extra work. This card cannot size the bridge route more precisely without reading the bridges repository.
6. Risks, unknowns and what to verify
All of these are Tencent-side and should be checked against the current WeCom developer documentation and one real test corp before dispatch.
- Trusted IP for self-built apps. As remembered: apps created since mid-2022 must list their caller addresses as 企业可信IP, and calls from other addresses are refused (errcode 60020). The setting is said to be available only after the app has either a trusted domain or a configured receive-message URL. If so, the callback endpoint (W5) is a precondition for sending at all, and every self-hosted deployment needs a stable egress address (W9). Verify the rule, the address limit, and whether a deployment behind changing cloud addresses can work.
- Trusted domain and ICP filing. Web authorization (the "Connect WeCom" path of W6) needs the app's trusted domain; as remembered, the domain must be ICP-filed and its filing subject must match the corp (or a related entity). A self-hosted org on its own filed domain is fine; an org using a hosted ObjectOS domain is not, without the service-provider app. Verify whether the receive-message URL of a self-built app has the same filing requirement.
- Email is often not there. Many WeCom members have no email on file, and since 2022 newly created apps do not read members' mobile or email without the member's own consent. The lookups by email and by mobile take a value and return a userid, so they may still work for members in the app's visible range — unverified. Expect the mobile number to match more often than email, and expect the web-authorization path to be the reliable one. The Slack ruling's "proposed by email match" therefore becomes "proposed by email or mobile match where the corp allows it, otherwise connect" — a wording change the addendum (W1) has to carry.
- Service-provider userids. For a third-party app the member id is an encrypted, provider-scoped id, and neither email nor mobile is available. Hosted binding is then web authorization only; no match can be proposed. Verify.
- Service-provider registration and review. Registering as a provider, getting the app reviewed and listed, and the review's requirements (company entity in China, test corp, privacy terms) are unknown in duration. E1 cannot ship before this completes.
- Interface licences. As remembered, since 2022 Tencent charges service-provider and provider-built apps a per-member interface licence, while self-built apps are exempt. If it applies to app messages, the hosted app carries a per-seat cost and E6 is real. This affects pricing, not only effort.
- Rate limits. As remembered: an app may send one member about 30 messages a minute and 1000 an hour, and a corp's daily total is capped per member seat;
gettokenitself is rate limited. Reminder and escalation storms need therate_limitedclass to back off rather than burn retries. Verify the numbers and the error codes. - Message types. Text card and template card field limits, which WeCom client versions render template cards, and whether members who read through the WeChat plugin see them. The fallback is plain text with the link.
- Deep link sign-in. The link opens in WeCom's built-in browser, where the person has no ObjectOS session. Sign-in with WeCom is the bridges epic's B3 and is not in this card; without it the person signs in once per device. ADR-0043 action links avoid the session but carry a bearer token, which
approval-service.tsdeliberately keeps out of stored payloads (approvals: authorization defect in approval action links (18.0 QA sweep) — detail withheld pending maintainer #24564). - Data residency. Member ids and message text leave the deployment for Tencent. Approval pages already withhold record titles from session-less readers (security(approvals): the inbox's subject record_title is resolved under the system context and served to every approver without their field-level security, against payload-redaction's serve-time contract and #7497's ruling C #23594); the card text should follow the same rule or the per-recipient field-security rule, to be decided in W4.
- Token cache across nodes. The existing cache is per process. For self-built apps
gettokenreturns the same token within its lifetime, so several nodes are fine; the suite-ticket chain of E1 needs shared state. - Not verified in this research: the contents of
objectstack-ai/bridges; where the AI pending-action queue is implemented and whether it can emit a notification; any behaviour against a live corp.
7. Edition question and recommended split
Background: on #34730 the maintainer ruled that Slack DMs are usable on self-hosted community deployments — one install per org with the org's own app, and the confirm-once person link, are open; enterprise keeps the hosted one-click app, managed credentials and vault, account health, and the managed multi-workspace lifecycle. The Teams review of the same day reached the same shape: do not gate the channel, gate the managed layer.
Recommended, consistent with that ruling: open — the self-built app (自建应用) install, one sys_channel_account row per org, the confirm-once sys_channel_user_link, app messages to the person, the callback endpoint, the admin and personal settings UI (W1–W11). Enterprise — the hosted service-provider app (第三方应用) with one-click install across corps, managed credentials and vault, account health, multi-corp management, and the China-hosted callback ingress (E1–E5). The mapping is direct: a self-built app is "each org installs its own", the service-provider app is "one ObjectOS app, N installs". One WeCom-specific consequence the maintainer should see: a hosted org without the enterprise app can use the open path only if hosted ObjectOS offers fixed egress addresses and the org accepts that "Connect WeCom" may be unavailable on a domain it has not filed — so on hosted, WeCom leans on the enterprise item more than Slack does.
Decisions needed
- Route: first-party
wecomchannel in the framework (the notifications: a Slack messaging channel with per-person binding — the org installs a Slack app once, each person's notifications arrive as Slack DMs (ADR-0013 / ADR-0022 / ADR-0030) #34730 shape, estimated here), or the [Epic] Bridges — vendor suites (DingTalk, WeCom, Feishu) behind the standard protocols the platform speaks: the platform's generic interfaces (webhook channel, inbound webhook, OIDC, SCIM) and the objectstack-ai/bridges repository #27314 bridge. - Order: after notifications: a Slack messaging channel with per-person binding — the org installs a Slack app once, each person's notifications arrive as Slack DMs (ADR-0013 / ADR-0022 / ADR-0030) #34730's shared pieces (saves about 13–21 days), or in parallel.
- Whether deciding inside the chat (W12) is wanted at all.
- Whether to start the Tencent service-provider registration now, since it is calendar-bound and blocks every enterprise item.
Activity