You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/04/13 15:35:11 UTC

[dolphinscheduler] branch dev updated: [FIX][WEBSITE-9224]fix wechat doc and wechat form display (#9439)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new df791a374e [FIX][WEBSITE-9224]fix wechat doc and wechat form display (#9439)
df791a374e is described below

commit df791a374edb63bff6efd20bc85cad60d945e750
Author: Tq <ti...@gmail.com>
AuthorDate: Wed Apr 13 23:35:05 2022 +0800

    [FIX][WEBSITE-9224]fix wechat doc and wechat form display (#9439)
    
    Co-authored-by: Jiajie Zhong <zh...@hotmail.com>
---
 docs/docs/en/guide/alert/enterprise-wechat.md      |  65 +++++++++++++++++++--
 docs/docs/zh/guide/alert/enterprise-wechat.md      |  64 ++++++++++++++++++--
 docs/img/alert/enterprise-wechat-app-msg-md.png    | Bin 0 -> 54994 bytes
 docs/img/alert/enterprise-wechat-app-msg.png       | Bin 0 -> 18009 bytes
 docs/img/alert/enterprise-wechat-create-group.png  | Bin 0 -> 32570 bytes
 docs/img/alert/enterprise-wechat-group-msg-md.png  | Bin 0 -> 52086 bytes
 docs/img/alert/enterprise-wechat-group-msg.png     | Bin 0 -> 43359 bytes
 docs/img/alert/enterprise-wechat-query-userid.png  | Bin 0 -> 18747 bytes
 docs/img/alert/wechat-app-form-example.png         | Bin 0 -> 22056 bytes
 docs/img/alert/wechat-group-form-example.png       | Bin 0 -> 23285 bytes
 .../plugin/alert/wechat/WeChatType.java            |   4 +-
 11 files changed, 123 insertions(+), 10 deletions(-)

diff --git a/docs/docs/en/guide/alert/enterprise-wechat.md b/docs/docs/en/guide/alert/enterprise-wechat.md
index 750c10c583..41970143df 100644
--- a/docs/docs/en/guide/alert/enterprise-wechat.md
+++ b/docs/docs/en/guide/alert/enterprise-wechat.md
@@ -1,14 +1,71 @@
 # Enterprise WeChat
 
-If you need to use `Enterprise WeChat` to alert, create an alert instance in the alert instance management, and choose the WeChat plugin.
+If you need to use `Enterprise WeChat` to alert, create an alert instance in the alert instance management, and choose the `WeChat` plugin.
 The following is the `WeChat` configuration example:
 
 ![enterprise-wechat-plugin](/img/alert/enterprise-wechat-plugin.png)
 
-The parameter `send.type` corresponds to app and group chat respectively:
+## Send Type
+
+The parameter `send.type` corresponds to sending messages to Enterprise WeChat customized APP and group chat created by API respectively.
+
+### APP
+
+The APP sends type means to notify the alert results via Enterprise WeChat customized APPs, supports sending messages to both specified users and all members. Currently, send to specified enterprise department and tags are not supported, a new PR to contribute is welcomed.
+The following is the `APP` alert config example:
+
+![enterprise-wechat-app-msg-config](/img/alert/wechat-app-form-example.png)
+
+The following is the `APP` `MARKDOWN` alert message example:
+
+![enterprise-wechat-app-msg-markdown](/img/alert/enterprise-wechat-app-msg-md.png)
+
+The following is the `APP` `TEXT` alert message example:
+
+![enterprise-wechat-app-msg-text](/img/alert/enterprise-wechat-app-msg.png)
+
+#### Prerequisites
+
+Need to create a new customized APP in Enterprise WeChat before sending messages to APP, create at the [APP Page](https://work.weixin.qq.com/wework_admin/frame#apps) and acquire the APP `AgentId` and set its visible scope to the root of the hierarchy.
+
+#### Send Messages to Specified Users
+
+The Enterprise WeChat APPs support sending messages to both specified users and all members, using `|` to separate multiple `userIds` and using `@all` to send messages to everyone.
+To acquire user `userId` refer to [Official Doc](https://developer.work.weixin.qq.com/document/path/95402), acquire `userId` by user phone number.
+The following is the `query userId` API example:
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-query-userid.png)
+
+#### References
 
 APP: https://work.weixin.qq.com/api/doc/90000/90135/90236
 
-Group Chat: https://work.weixin.qq.com/api/doc/90000/90135/90248
 
-The parameter `user.send.msg` corresponds to the `content` in the document, and the corresponding variable is `{msg}`.
\ No newline at end of file
+### Group Chat
+
+The Group Chat send type means to notify the alert results via group chat created by Enterprise WeChat API, sending messages to all members of the group and specified users are not supported.
+The following is the `Group Chat` alert config example:
+
+![enterprise-wechat-app-msg-config](/img/alert/wechat-group-form-example.png)
+
+The following is the `APP` `MARKDOWN` alert message example:
+
+![enterprise-wechat-group-msg-markdown](/img/alert/enterprise-wechat-group-msg-md.png)
+
+The following is the `Group Chat` `TEXT` alert message example:
+
+![enterprise-wechat-group-msg-text](/img/alert/enterprise-wechat-group-msg.png)
+
+#### Prerequisites
+
+Before sending messages to group chat, create a new group chat by Enterprise WeChat API, refer to [Official Doc](https://developer.work.weixin.qq.com/document/path/90245) to create a new one and acquire `chatid`.
+To acquire user `userId` refer to [Official Doc](https://developer.work.weixin.qq.com/document/path/95402), acquire `userId` by user phone number.
+The following is the `create new group chat` API and `query userId` API example:
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-create-group.png)
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-query-userid.png)
+
+#### References
+
+Group Chat:https://work.weixin.qq.com/api/doc/90000/90135/90248
\ No newline at end of file
diff --git a/docs/docs/zh/guide/alert/enterprise-wechat.md b/docs/docs/zh/guide/alert/enterprise-wechat.md
index e79c322afe..263a44a257 100644
--- a/docs/docs/zh/guide/alert/enterprise-wechat.md
+++ b/docs/docs/zh/guide/alert/enterprise-wechat.md
@@ -1,13 +1,69 @@
 # 企业微信
 
-如果您需要使用到企业微信进行告警,请在告警实例管理里创建告警实例,选择 WeChat 插件。企业微信的配置样例如下
+如果您需要使用到企业微信进行告警,请在告警实例管理里创建告警实例,选择 WeChat 插件。企业微信的配置样例如下:
 
 ![enterprise-wechat-plugin](/img/alert/enterprise-wechat-plugin.png)
 
-其中 send.type 分别对应企微文档:
+## 发送类型
+
+其中`send.type`分别对应向企业微信自定义应用发送和向企业微信API创建的群聊发送消息。
+
+### 应用
+
+应用指将告警结果通过企业微信的自定义应用进行通知,支持向特定用户发送消息和对所有人发送消息。目前还不支持部门和标签,欢迎提PR贡献代码。
+下图是应用告警配置的示例:
+
+![enterprise-wechat-app-msg-config](/img/alert/wechat-app-form-example.png)
+
+下图是`应用``MARKDOWN`告警消息的示例:
+
+![enterprise-wechat-app-msg-markdown](/img/alert/enterprise-wechat-app-msg-md.png)
+
+下图是`应用``TEXT`告警消息的示例:
+
+![enterprise-wechat-app-msg-text](/img/alert/enterprise-wechat-app-msg.png)
+
+#### 前置
+
+向企业微信应用发送消息之前需要在企业微信中创建自定义应用,请在[应用页面](https://work.weixin.qq.com/wework_admin/frame#apps) 进行创建,获取应用的`AgentId`并将可见范围设为根。
+
+#### 向指定用户发消息
+
+企业微信应用支持向特定用户发送消息和对所有人发送消息,分别为使用`|`分隔多个userId和使用`@all`向所有人发送信息。
+获取用户的userId请参考[官方文档](https://developer.work.weixin.qq.com/document/path/95402)根据手机号获取userId。
+下图是获取userId接口的示例:
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-query-userid.png)
+
+#### 参考文档
 
 应用:https://work.weixin.qq.com/api/doc/90000/90135/90236
 
-群聊:https://work.weixin.qq.com/api/doc/90000/90135/90248
+### 群聊
+
+群聊指将告警结果通过企业微信API创建的群聊进行通知,会向该群聊下的所有人发送消息,不支持向特定用户发送消息。
+下图是群聊告警配置的示例:
+
+![enterprise-wechat-group-msg-config](/img/alert/wechat-group-form-example.png)
+
+下图是`群聊``MARKDOWN`告警消息的示例:
+
+![enterprise-wechat-group-msg-markdown](/img/alert/enterprise-wechat-group-msg-md.png)
+
+下图是`群聊``TEXT`告警消息的示例:
+
+![enterprise-wechat-group-msg-text](/img/alert/enterprise-wechat-group-msg.png)
+
+#### 前置
+
+向企业微信群聊发送消息之前需要通过企业微信的API创建群聊,请参考[官方文档](https://developer.work.weixin.qq.com/document/path/90245) 进行创建群聊并获取`chatid`。
+其中获取用户的userId请参考[官方文档](https://developer.work.weixin.qq.com/document/path/95402)根据手机号获取userId。
+下图是创建新聊天群组和获取userId接口的示例:
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-create-group.png)
+
+![enterprise-wechat-create-group](/img/alert/enterprise-wechat-query-userid.png)
+
+#### 参考文档
 
-user.send.msg 对应文档中的 content,与此相对应的值的变量为 {msg}
\ No newline at end of file
+群聊:https://work.weixin.qq.com/api/doc/90000/90135/90248
\ No newline at end of file
diff --git a/docs/img/alert/enterprise-wechat-app-msg-md.png b/docs/img/alert/enterprise-wechat-app-msg-md.png
new file mode 100644
index 0000000000..6503e0eb8b
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-app-msg-md.png differ
diff --git a/docs/img/alert/enterprise-wechat-app-msg.png b/docs/img/alert/enterprise-wechat-app-msg.png
new file mode 100644
index 0000000000..d439171345
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-app-msg.png differ
diff --git a/docs/img/alert/enterprise-wechat-create-group.png b/docs/img/alert/enterprise-wechat-create-group.png
new file mode 100644
index 0000000000..3e7d304f38
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-create-group.png differ
diff --git a/docs/img/alert/enterprise-wechat-group-msg-md.png b/docs/img/alert/enterprise-wechat-group-msg-md.png
new file mode 100644
index 0000000000..3fb5da33c9
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-group-msg-md.png differ
diff --git a/docs/img/alert/enterprise-wechat-group-msg.png b/docs/img/alert/enterprise-wechat-group-msg.png
new file mode 100644
index 0000000000..39830bd312
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-group-msg.png differ
diff --git a/docs/img/alert/enterprise-wechat-query-userid.png b/docs/img/alert/enterprise-wechat-query-userid.png
new file mode 100644
index 0000000000..a7fb3b50bb
Binary files /dev/null and b/docs/img/alert/enterprise-wechat-query-userid.png differ
diff --git a/docs/img/alert/wechat-app-form-example.png b/docs/img/alert/wechat-app-form-example.png
new file mode 100644
index 0000000000..d425da784b
Binary files /dev/null and b/docs/img/alert/wechat-app-form-example.png differ
diff --git a/docs/img/alert/wechat-group-form-example.png b/docs/img/alert/wechat-group-form-example.png
new file mode 100644
index 0000000000..c289ebc95c
Binary files /dev/null and b/docs/img/alert/wechat-group-form-example.png differ
diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatType.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatType.java
index eac208a97b..9060b53089 100644
--- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatType.java
+++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatType.java
@@ -19,8 +19,8 @@
 package org.apache.dolphinscheduler.plugin.alert.wechat;
 
 public enum WeChatType {
-    APP(1, "应用"),
-    APPCHAT(2, "群聊"),
+    APP(1, "APP/应用"),
+    APPCHAT(2, "GROUP CHAT/群聊"),
     ;
 
     private final int code;