企业微信接受消息 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
})
相关推荐
linda`li2 天前
如何使用TRAE+Figma自动生成前端代码
微信·figma·自动写代码
随性而行3603 天前
企业微信 API 如何实现业务消息自动通知?接口应用场景解析
java·人工智能·后端·微信·机器人·企业微信
极客互动API3 天前
企业微信二次开发 API:如何与 SCRM 打通外部联系人的消息发送
微信·企业微信·企微scrm·企业微信api·企微外部联系人
随性而行3608 天前
企业微信API调用案例:如何通过接口实现多账号统一管理与业务接入?
运维·微信·机器人·自动化·企业微信
随性而行3608 天前
企业微信API接口开发实战:如何实现消息回调接收与业务事件处理?
java·前端·python·微信·机器人·企业微信
Eddyp8 天前
涡街 电磁流量计、压力变送器,手操器组态实操要点
微信·微信公众平台·facebook·新浪微博·微信开放平台
后除9 天前
Go 实战: 使用 Wails v2.15 构建轻量级的桌面应用 - 仿微信登录界面
开发语言·微信·golang
GeWeAPI技术支持9 天前
个人微信API二次开发:如何给消息回调增加异常日志和排查线索
人工智能·微信
凡泰极客科技10 天前
如何让企业App像微信一样,运行短剧、外卖和小游戏?
微信