16

企业微信机器人 Webhook 推送语雀更新消息

 2 years ago
source link: https://huhuhang.com/post/coding/yuque-wecom-bot
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

企业微信机器人 Webhook 推送语雀更新消息

语雀是非常出色的团队协作知识库平台,而将更新日志推送到 IM 群聊中,可以让你的团队更快地掌握知识库的最新进展。目前,语雀官方仅支持快速配置钉钉机器人,例如我所在的团队日常却使用企业微信。

本项目提供了基于 Cloudflare Workers 部署 API,支持快速配置语雀 Webhook 将操作消息推送给企业微信机器人。

示例如下:

1643889452224.png

目前支持知识库文档新增、更新等操作的消息提醒。

你可以使用本项目配置好的服务:

  • Webhook URL: https://yuque-wecom-bot.huhuhang.workers.dev?key=<你的机器人密钥>

为了更好的可用性,推荐按照下方步骤自行部署。

你可以直接在 Cloudflare Workers 网页版中新建项目,并复制本仓库中的 index.js 到在线编辑器中部署。

或者使用官方提供的 wrangler cli 工具:

  1. 了解 Cloudflare Workers 命令行工具 wrangler 的使用方法。

  2. 基于本项目初始化一个新的项目。

    wrangler generate yuque-wecom-bot https://github.com/huhuhang/yuque-wecom-bot
    
  1. 请修改 wrangler.toml 中预留的 account_id,替换为你的账户信息。

  2. yuque-wecom-bot 项目添加到 Cloudflare Workers 部署。

  1. 基于上述步骤在 Cloudflare Workers 中部署完成后,你会得到类似 https://yuque-wecom-bot.你的自定义域名.workers.dev 的路由地址。
  1. 创建企业微信机器人,并获得 Webhook Key。
  1. 此时 Webhook 推送地址为:https://yuque-wecom-bot.你的自定义域名.workers.dev/?key=你的企业微信机器人KEY

  2. 在语雀配置 Webhook,将 Webhook 的 URL 替换为上述路由地址。

相关代码已经放置到开源仓库地址:https://github.com/huhuhang/yuque-wecom-bot


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK