企业微信接受消息 API 的设置

Server 可以用本地 VSCode 端口转发加 VSCode 自带的内网穿透来实现, 代码如下:

typescript 复制代码
import crypto from "node:crypto"
import { decrypt } from "@wecom/crypto"
export default defineEventHandler((event) => {
  const { msg_signature, timestamp, nonce, echostr } = getQuery(event)
  const shasum = crypto.createHash("sha1")
  const token = "---"
  const encodingAesKey = "---"
  shasum.update([token, timestamp, nonce, echostr].sort().join(""))
  const str = shasum.digest("hex")
  if (str !== msg_signature) {
    return "error"
  }
  const { message } = decrypt(encodingAesKey, echostr as string)
  return message
})
相关推荐
陈思杰系统思考Jason9 小时前
业务创新与系统思考
百度·微信·微信公众平台·新浪微博·微信开放平台
liugang_lawyer1 天前
防范新型金融诈骗
笔记·百度·微信·金融·微信公众平台·新浪微博
陈思杰系统思考Jason2 天前
系统思考:决策
百度·微信·微信公众平台·新浪微博·微信开放平台
优梦创客2 天前
3 天搞定微小游戏上架!独立开发者副业赚钱全攻略(附选题 / 技术 / 运营干货)
微信·教程·小游戏·游戏开发
Jing_Rainbow2 天前
【 Weapp-3 /Lesson20(2025-11-04)】路虎卫士小程序开发详解:从架构到细节的深度解析🚙📱
微信·微信小程序·程序员
Jing_Rainbow3 天前
【Weapp-2 /Lesson19(2025-11-04)】微信小程序“博客园”项目深度解析:从架构到细节的完整剖析📱
微信·微信小程序·程序员
陈思杰系统思考Jason3 天前
投资不足:成长上限的关键因素
百度·微信·微信公众平台·新浪微博·微信开放平台
Jing_Rainbow4 天前
【 Weapp-1 /Lesson18(2025-11-03)】# 微信小程序开发全解析:从项目结构到生态优势 🚀
微信·微信小程序·程序员
JHC0000004 天前
发现个微信客户端的bug
微信·bug