mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-30 10:07:06 +08:00 
			
		
		
		
	🎨 #3179 【企业微信】群机器人发送消息接口中增加发送语音类型消息的方法
This commit is contained in:
		| @ -98,6 +98,15 @@ public interface WxCpGroupRobotService { | |||||||
|    */ |    */ | ||||||
|   void sendFile(String webhookUrl, String mediaId) throws WxErrorException; |   void sendFile(String webhookUrl, String mediaId) throws WxErrorException; | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 发送文件类型的消息 | ||||||
|  |    * | ||||||
|  |    * @param webhookUrl webhook地址 | ||||||
|  |    * @param mediaId    语音文件id | ||||||
|  |    * @throws WxErrorException 异常 | ||||||
|  |    */ | ||||||
|  |   void sendVoice(String webhookUrl, String mediaId) throws WxErrorException; | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 发送模板卡片消息 |    * 发送模板卡片消息 | ||||||
|    * @param webhookUrl |    * @param webhookUrl | ||||||
|  | |||||||
| @ -92,6 +92,14 @@ public class WxCpGroupRobotServiceImpl implements WxCpGroupRobotService { | |||||||
|       .setMediaId(mediaId).toJson()); |       .setMediaId(mediaId).toJson()); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public void sendVoice(String webhookUrl, String mediaId) throws WxErrorException { | ||||||
|  |     this.cpService.postWithoutToken(webhookUrl, new WxCpGroupRobotMessage() | ||||||
|  |       .setMsgType(GroupRobotMsgType.VOICE) | ||||||
|  |       .setMediaId(mediaId).toJson()); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public void sendTemplateCardMessage(String webhookUrl, WxCpGroupRobotMessage wxCpGroupRobotMessage) throws WxErrorException { |   public void sendTemplateCardMessage(String webhookUrl, WxCpGroupRobotMessage wxCpGroupRobotMessage) throws WxErrorException { | ||||||
|     this.cpService.postWithoutToken(webhookUrl, wxCpGroupRobotMessage.toJson()); |     this.cpService.postWithoutToken(webhookUrl, wxCpGroupRobotMessage.toJson()); | ||||||
|  | |||||||
| @ -536,6 +536,11 @@ public class WxCpConsts { | |||||||
|      */ |      */ | ||||||
|     public static final String FILE = "file"; |     public static final String FILE = "file"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 文件类型消息. | ||||||
|  |      */ | ||||||
|  |     public static final String VOICE = "voice"; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 模版类型消息. |      * 模版类型消息. | ||||||
|      */ |      */ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Hugo-Ho
					Hugo-Ho