企业微信接受消息 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
})
相关推荐
弓乙图12 小时前
弓乙歌/岐黄真源赋
经验分享·微信
2601_9611940214 小时前
初中英语教资笔试资源|科三教案模板和知识点资料
百度·微信·微信公众平台·facebook·twitter·新浪微博
梁辰兴1 天前
微信小程序开发者工具下载与安装
微信·微信小程序·小程序·教程·软件安装·开发者工具
Thomas_YXQ3 天前
Unity无GC读取图片与网格完整方案
大数据·人工智能·unity·微信·产品运营
山川而川-R3 天前
调用微信开源二维码模型
微信·开源
凌涘4 天前
依托 BEM 规范深度剖析 WeUI 微信按钮组件开发与实现
前端·微信
m0_696212685 天前
如何用微信 API 实现多群消息同步和定时群发
微信
罗光记5 天前
Solon Server 启动模式深度解析:从 0.3MB 内核到 10+ Server 插件
其他·百度·微信·微信公众平台·新浪微博
阳明山水8 天前
销量预测模型评估进阶:从 MAPE 到库存周转率与缺货损失金额
人工智能·机器学习·微信·微信公众平台·微信开放平台
wan55cn@126.com9 天前
调试协作之歌
人工智能·笔记·微信