Class WeComCallbackController
java.lang.Object
io.agentscope.extensions.channel.wecom.WeComCallbackController
@RestController
@RequestMapping("/api/channels/wecom")
public class WeComCallbackController
extends Object
Handles the WeCom callback URL handshake (GET) and inbound encrypted message delivery (POST).
Each WeComChannel registers itself with the controller at start-up; the controller
dispatches incoming requests by channelId extracted from the URL path. This avoids
Spring-side dynamic mapping registration and keeps wiring trivially testable.
-
Constructor Details
-
WeComCallbackController
public WeComCallbackController()
-
-
Method Details
-
verify
@GetMapping(value="/{channelId}/callback", produces="text/plain") public org.springframework.http.ResponseEntity<String> verify(@PathVariable String channelId, @RequestParam("msg_signature") String signature, @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam("echostr") String echostr) URL verification handshake. WeCom calls this with an encryptedechostrthat the server must decrypt and return verbatim so WeCom can confirm the server holds the right encoding AES key. -
dispatch
@PostMapping(value="/{channelId}/callback", consumes="application/xml", produces="text/plain") public reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<String>> dispatch(@PathVariable String channelId, @RequestParam("msg_signature") String signature, @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestBody String body) Inbound encrypted message. The request body is XML containing<Encrypt>...</Encrypt>. Verifies signature, decrypts, deduplicates byMsgId, applies bot-loop guard, then dispatches to the channel for routing. Always returns200so WeCom does not retry, unless the signature is invalid or the channel is unknown.
-