Tencent/WeKnora · warning
WeChat adapter does not support webhook callbacks
Error message
WeChat adapter does not support webhook callbacks
What it means
The WeChat (iLink) adapter communicates exclusively via long-polling, so its VerifyCallback method intentionally returns a fixed error stating that webhook callbacks are unsupported. Hitting this means code is treating the WeChat adapter as if it had a webhook-based platform like Slack or WeCom.
Source
Thrown at internal/im/wechat/adapter.go:86
botToken string
ilinkBotID string
}
// NewAdapter creates a new WeChat iLink adapter.
func NewAdapter(botToken, ilinkBotID string) *Adapter {
return &Adapter{
botToken: botToken,
ilinkBotID: ilinkBotID,
}
}
func (a *Adapter) Platform() im.Platform {
return im.PlatformWeChat
}
// VerifyCallback is not supported — WeChat iLink uses long-polling, not webhooks.
func (a *Adapter) VerifyCallback(c *gin.Context) error {
return fmt.Errorf("WeChat adapter does not support webhook callbacks")
}
// ParseCallback is not supported — messages arrive via long-polling.
func (a *Adapter) ParseCallback(c *gin.Context) (*im.IncomingMessage, error) {
return nil, fmt.Errorf("WeChat adapter does not support webhook callbacks")
}
// HandleURLVerification is not applicable for WeChat.
func (a *Adapter) HandleURLVerification(c *gin.Context) bool {
return false
}
// SendReply sends a text reply to the user via iLink /ilink/bot/sendmessage API.
func (a *Adapter) SendReply(ctx context.Context, incoming *im.IncomingMessage, reply *im.ReplyMessage) error {
contextToken := ""
if incoming.Extra != nil {
contextToken = incoming.Extra["context_token"]
}View on GitHub (pinned to 988cbb0330)
Solutions
- Do not route webhook requests to the WeChat adapter; rely on its long-poll client (NewLongPollClient) for inbound messages.
- Add a capability check (e.g. platform == im.PlatformWeChat) before calling VerifyCallback and skip/short-circuit for WeChat.
- If webhook delivery is genuinely required, use the WeCom adapter instead, which supports callbacks.
Example fix
// before
if err := adapter.VerifyCallback(c); err != nil { ... }
// after
if platform == im.PlatformWeChat {
return // handled by long-polling; no webhook endpoint
}
if err := adapter.VerifyCallback(c); err != nil { ... } Defensive patterns
Strategy: type-guard
Validate before calling
// capability check before dispatching webhooks
if ch.Platform == im.PlatformWeChat {
c.Status(http.StatusNoContent)
return // no webhook surface; long-polling handles messages
} Type guard
func supportsWebhooks(p im.Platform) bool {
return p != im.PlatformWeChat
} Try / catch
if err := adapter.VerifyCallback(c); err != nil {
if strings.Contains(err.Error(), "does not support webhook callbacks") {
c.Status(http.StatusNotImplemented)
return
}
c.String(http.StatusUnauthorized, "verify failed")
} Prevention
- Route webhook HTTP traffic only to webhook-capable platforms (Slack, WeCom).
- Encode adapter capabilities in an interface or capability method instead of relying on errors.
- Add integration tests asserting WeChat inbound flow goes through the long-poll client.
When it happens
Trigger: Calling Adapter.VerifyCallback with a gin.Context on a WeChat channel — typically from a generic HTTP handler that routes inbound webhook requests to the channel's adapter without checking platform capability.
Common situations: Registering a shared /webhooks/:platform route for all IM platforms; switching a channel's platform from Slack to WeChat without changing the callback wiring; writing integration tests that assume every adapter implements webhook verification.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- local file service cannot copy %q: %w
- invalid verification token
- parse wechat credentials: %w
- wechat credentials require bot_token and ilink_bot_id
- decrypt message: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/757dc387cf0fd739.
Report an issue: GitHub.