Package com.bytedesk.wechat.work
Class WeChatWorkRobotClient
java.lang.Object
com.bytedesk.wechat.work.WeChatWorkRobotClient
企业微信群机器人客户端
文档: https://developer.work.weixin.qq.com/document/path/91770
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private final com.fasterxml.jackson.databind.ObjectMapper
private final org.springframework.web.client.RestTemplate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription发送文件消息发送图片消息sendMarkdown
(String key, String content) 发送Markdown消息sendMessage
(String key, Map<String, Object> message) 通用消息发送方法发送图文消息发送文本消息
-
Field Details
-
restTemplate
private final org.springframework.web.client.RestTemplate restTemplate -
objectMapper
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper -
BASE_URL
- See Also:
-
-
Constructor Details
-
WeChatWorkRobotClient
public WeChatWorkRobotClient()
-
-
Method Details
-
sendText
public Map<String,Object> sendText(String key, String content, List<String> mentionedList, List<String> mentionedMobileList) 发送文本消息- Parameters:
key
- webhook的keycontent
- 文本内容mentionedList
- 要@的用户ID列表mentionedMobileList
- 要@的手机号列表- Returns:
- 发送结果
-
sendMarkdown
发送Markdown消息- Parameters:
key
- webhook的keycontent
- Markdown内容- Returns:
- 发送结果
-
sendImage
发送图片消息- Parameters:
key
- webhook的keybase64
- 图片的base64编码md5
- 图片的md5值- Returns:
- 发送结果
-
sendNews
发送图文消息- Parameters:
key
- webhook的keyarticles
- 图文消息列表- Returns:
- 发送结果
-
sendFile
发送文件消息- Parameters:
key
- webhook的keymediaId
- 文件ID- Returns:
- 发送结果
-
sendMessage
通用消息发送方法- Parameters:
key
- webhook的keymessage
- 消息内容- Returns:
- 发送结果
-