流程圖:
只是這里的消息回調,僅作為提示,群內有消息了。不是具體的消息,而是類似這樣的結構,:
如果需要獲取消息,還需要拉取企微群內消息方法,這個后續再更新。
好了,我們開始吧。
開啟消息回調和接收消息回調,地址是一樣的,只是
開啟消息回調,get請求,
接受消息回調,post請求。
代碼如下:
開啟消息回調
Controller層:
@ApiOperation(value = "企業微信url驗證")
@GetMapping("/weworkUrl")
public void weworkUrl(@RequestParam(name = "msg_signature")String msgSignature,@RequestParam(name = "timestamp")String timestamp,@RequestParam(name = "nonce")String nonce,@RequestParam(name = "echostr")String echostr, HttpServletResponse response) {try {echostr = echostr.replace(" ", "+");//有時+號會被刪除queryMarketingRecordService.weworkUrl(msgSignature,timestamp,nonce,echostr,response);} catch (Exception e) {e.printStackTrace();LogUtils.info("Exception 企業微信url驗證出錯:"+(e.getMessage().length() > 2000 ? e.getMessage().substring(0, 2000) : e.getMessage())