npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@youdaa/wechat-open-sdk

v1.3.7

Published

WeChat Auth Hub (WAH) Node.js Client SDK

Readme

@youdaa/wechat-open-sdk

微信开放中台 (WeChat Auth Hub, WAH) 客户端 Node.js SDK。提供自动签名、参数鉴权和接口请求封装,助力子项目极速接入。

安装

npm install @youdaa/wechat-open-sdk

或通过 Git 直接安装:

npm install git+https://git.your-server.com/youdian/wechat-open-sdk.git#v1.0.0

使用指南

1. 初始化

import { WahClient, WAH_API_BASE, WAH_WEB_BASE } from '@youdaa/wechat-open-sdk';

const wahClient = new WahClient({
  clientAppId: '您的 WAH_CLIENT_APPID',
  clientAppSecret: '您的 WAH_CLIENT_APPSECRET',
  // 平台地址已内置:WAH_API_BASE / WAH_WEB_BASE,无需传入
});

2. 常用功能调用

获取商户微信授权扫码预授权 URL

const { wechatAuthUrl } = await wahClient.getPreAuthUrl('merchant_998');

获取商户授权绑定状态

const { isBound, nickName, authorizerAppId } = await wahClient.getAuthStatus('merchant_998');

生成 iframe 嵌入面板 URL(紧凑模式 + 主题同步)

const { timestamp, nonce, signature } = wahClient.signStatusRequest('merchant_998');
const iframeUrl = wahClient.buildIframePanelUrl({
  merchantId: 'merchant_998',
  timestamp,
  nonce,
  signature,
  theme: {
    uiTheme: 'dark',      // light | dark 两套预置
    themeColor: 'c9a227', // 可选,覆盖品牌主色
  },
});

代已绑定的公众号发送模板消息

const res = await wahClient.sendTemplateMessage({
  authorizer_appid: '商户绑定的公众号 AppID',
  touser: '接收粉丝的 OpenID',
  template_id: '模板消息 ID',
  url: 'https://m.yourdomain.com/detail',
  data: {
    first: { value: '您有新的订单通知。', color: '#173177' },
    keyword1: { value: '微信中枢 SDK', color: '#173177' }
  }
});
console.log('发送成功,微信消息 ID 为:', res.msgid);

获取微信网页静默授权 OpenID

const { openid } = await wahClient.getOauthOpenId('temp_code_xxxxx');

代公众号计算 JSSDK 签名

const signatureConfig = await wahClient.getJssdkSignature('authorizerAppId', '当前网页完整URL');

开发与发布

如果您是维护者,并且需要更新、编译并发布此 SDK,请参考 RELEASE.md 获取详细的发布指南。