wecom-integration

wecom-integration is a skill for Claude Code, Codex from nongjun/feishu-cursor-claw. It costs 59 tokens per session (844 once invoked), scanned A, original, MIT.

A shared integration guide for WeCom, a business messaging and workplace platform, including login, browser-side setup, tokens, and user authentication.

In plain words
What is it for?
Use it when building WeCom apps or sidebars, signing WeCom browser requests, logging users in with OAuth, or sending messages and handling contacts.
Why use it?
It avoids each project module implementing its own WeCom login, token handling, and API connection rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building WeCom apps or sidebars, signing WeCom browser requests, logging users in with OAuth, or sending messages and handling contacts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nongjun/feishu-cursor-claw/wecom-integration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nongjun/feishu-cursor-claw --skill wecom-integration
Clone the repo
git clone --depth 1 https://github.com/nongjun/feishu-cursor-claw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wecom-integration

README.md
[![agentmods](https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/wecom-integration/github.svg)](https://agentmods.dev/skills/nongjun/feishu-cursor-claw/wecom-integration)
Your own site
<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/wecom-integration"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/wecom-integration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wecom-integration

Your own site · 80×15
<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/wecom-integration"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/wecom-integration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 844 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.00844
Opus 5 $0.00030 $0.00422
Sonnet 5 $0.00012 $0.00169
Haiku 4.5 $0.00006 $0.00084

Measured 9d ago against content hash 55e8cb866ac6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

wecom-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

参考代码/njcursor/skills/wecom-integration/SKILL.md · 83 lines

What it actually says

企微对接

架构概览

  • 后端:各模块 → shared_backend.WeComAuthService → 门户 Redis 缓存(首选)→ 企微 API(回退)
  • 前端:@wecom/jssdk npm 包 → ww.register() 一次初始化

核心服务

WeComAuthService(公共模块)

方法 用途
get_access_token() 获取 Token(优先门户缓存,回退直调企微)
generate_signature() JSSDK 签名(wx.config)
generate_agent_config_signature() agentConfig 签名
get_user_info_by_code() OAuth 授权码换用户信息
upload_media() 上传临时素材(支持图片自动压缩)
get_external_contact_detail() 获取外部联系人详情
send_welcome_msg() 发送新客户欢迎语

Token 获取策略

门户 Redis 共享缓存(多模块复用,避免限频)→ 失败回退 → 直调企微 API(本地内存缓存)。配置 PORTAL_API_URL 即可启用共享缓存。

SOP:JSSDK 初始化

前端(强制使用 @wecom/jssdk npm 包)

  1. npm install @wecom/jssdk
  2. import * as ww from '@wecom/jssdk'
  3. 调用 ww.register() 传入 corpId、agentId(数字类型)、签名获取函数
  4. 注册后直接调用 API,SDK 自动等待 config 完成

禁止使用旧版 CDN 脚本(jweixin/jwxwork)。

后端需提供的接口

  • POST /api/wecom/jsapi-signature{ timestamp, nonceStr, signature }
  • POST /api/wecom/agent-config-signature{ timestamp, nonceStr, signature }

SOP:OAuth 登录

标准流程

前端请求 OAuth URL → 跳转企微授权 → 回调带 code → 后端换 userid → 生成 JWT

跨域名中转方案(侧边栏等)

侧边栏检测无 userid → 跳转门户 /api/auth/wecom/authorize → 门户重定向企微授权(回调地址固定为门户 callback) → callback 换 userid → 重定向回原始 URL 附带 userid

一次性授权码(goto_code)

门户跳转子系统时使用,避免 Token 泄露到浏览器历史:

  • POST /api/auth/create-goto-code → 创建(60 秒过期)
  • POST /api/auth/exchange-code → 兑换 JWT Token

常见坑

问题 解决
invalid signature URL 必须 decodeURIComponent 后再签名
invalid agentid agentId 必须是数字类型
code已使用 code 只能用一次,用后清除 URL 参数

环境变量

  • WECOM_CORP_ID / WECOM_SECRET / WECOM_AGENT_ID
  • JWT_SECRET_KEY / JWT_ALGORITHM / JWT_EXPIRE_HOURS
  • PORTAL_API_URL(启用 Token 共享)

参考文件

  • 公共模块/shared_backend/services/wecom_auth.py
  • 公共模块/shared_backend/services/auth_service.py
  • 门户系统/后端服务/app/services/wecom_auth.py
  • 门户系统/后端服务/app/api/auth.py
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 83 lines · 59 tokens per session scan A 55e8cb866ac6

Subscribe to this mod's changes

wecom-integration is a skill published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It adds 59 tokens to every session and 844 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.