@ -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}`. |
||||
### 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 |
@ -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} |
||||
群聊:https://work.weixin.qq.com/api/doc/90000/90135/90248 |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 23 KiB |