[PR #5252] [CLOSED] Add work wechat webhook #17727

Closed
opened 2025-11-02 15:20:43 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/5252
Author: @rocklau
Created: 11/2/2018
Status: Closed

Base: masterHead: master


📝 Commits (4)

📊 Changes

13 files changed (+569 additions, -8 deletions)

View changed files

📝 models/webhook.go (+24 -5)
models/webhook_workwechat.go (+405 -0)
📝 modules/auth/repo_form.go (+12 -0)
📝 modules/setting/setting.go (+1 -0)
📝 options/locale/locale_en-US.ini (+2 -0)
public/img/workwechat.ico (+0 -0)
📝 routers/api/v1/convert/convert.go (+3 -1)
📝 routers/repo/webhook.go (+93 -1)
📝 routers/routes/routes.go (+4 -0)
📝 templates/org/settings/hook_new.tmpl (+4 -1)
📝 templates/repo/settings/webhook/list.tmpl (+3 -0)
📝 templates/repo/settings/webhook/new.tmpl (+3 -0)
templates/repo/settings/webhook/workwechat.tmpl (+15 -0)

📄 Description

new feature: send events to work wechat group

unit test done list

  1. create new work wechat webhook
  2. edit this webhook
  3. push a commit, wechat group received this event

work flow:

  1. this command can get access token

get CORP_ID from https://work.weixin.qq.com/wework_admin/frame#profile

get APP_SECRET from your corporation app profile /wework_admin/frame#apps/modApiApp/

curl -X GET \
  'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=CORP_ID&corpsecret=CORP_APP_SECRET' 
{
    "errcode": 0,
    "errmsg": "ok",
    "access_token": "",
    "expires_in": 7200
}
  1. and create your bot group 'gitea'
curl -X POST \
  'https://qyapi.weixin.qq.com/cgi-bin/appchat/create?access_token=ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name" : "Gitea",
    "owner" : "XiaoMing",
    "userlist" : ["XiaoMing","XiaoHong"],
    "chatid" : "gitea"
}'
  1. then we go to add new work wechat hook with access_token and chatid on gitea

TargetURL:https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token=ACCESS_TOKEN

Chat ID: gitea


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/5252 **Author:** [@rocklau](https://github.com/rocklau) **Created:** 11/2/2018 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (4) - [`25f9c13`](https://github.com/go-gitea/gitea/commit/25f9c13fa337d2a0698856f345e6ad65b518f326) Add work wechat webhook - [`b78a0e4`](https://github.com/go-gitea/gitea/commit/b78a0e4811464ddd2a1e842206e11936e62ded22) Merge branch 'master' into master - [`1dc8a2e`](https://github.com/go-gitea/gitea/commit/1dc8a2e09ebb10ed00afcc4e5c236d265a08fdd2) changes for reviews of pr #5252 - [`ab8fe77`](https://github.com/go-gitea/gitea/commit/ab8fe777bbc41c9eb80d9b1cb14c3f5d08d67929) Merge branch 'master' into master ### 📊 Changes **13 files changed** (+569 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `models/webhook.go` (+24 -5) ➕ `models/webhook_workwechat.go` (+405 -0) 📝 `modules/auth/repo_form.go` (+12 -0) 📝 `modules/setting/setting.go` (+1 -0) 📝 `options/locale/locale_en-US.ini` (+2 -0) ➕ `public/img/workwechat.ico` (+0 -0) 📝 `routers/api/v1/convert/convert.go` (+3 -1) 📝 `routers/repo/webhook.go` (+93 -1) 📝 `routers/routes/routes.go` (+4 -0) 📝 `templates/org/settings/hook_new.tmpl` (+4 -1) 📝 `templates/repo/settings/webhook/list.tmpl` (+3 -0) 📝 `templates/repo/settings/webhook/new.tmpl` (+3 -0) ➕ `templates/repo/settings/webhook/workwechat.tmpl` (+15 -0) </details> ### 📄 Description new feature: send events to work wechat group<chatid> unit test done list 1. create new work wechat webhook 2. edit this webhook 3. push a commit, wechat group received this event work flow: 1. this command can get access token get CORP_ID from https://work.weixin.qq.com/wework_admin/frame#profile get APP_SECRET from your corporation app profile /wework_admin/frame#apps/modApiApp/ ```bash curl -X GET \ 'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=CORP_ID&corpsecret=CORP_APP_SECRET' ``` ```json { "errcode": 0, "errmsg": "ok", "access_token": "", "expires_in": 7200 } ``` 2. and create your bot group 'gitea' ```bash curl -X POST \ 'https://qyapi.weixin.qq.com/cgi-bin/appchat/create?access_token=ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name" : "Gitea", "owner" : "XiaoMing", "userlist" : ["XiaoMing","XiaoHong"], "chatid" : "gitea" }' ``` 3. then we go to add new work wechat hook with access_token and chatid on gitea TargetURL:https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token=ACCESS_TOKEN Chat ID: gitea --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 15:20:44 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17727