{"record":{"id":"65ea978024fe8011","repo":"JeffreySu/WeiXinMPSDK","slug":"iresponsemessagetransfer-customer-service","errorCode":null,"errorMessage":"微信企业号不支持 IResponseMessageTransfer_Customer_Service 响应类型","messagePattern":"微信企业号不支持 IResponseMessageTransfer_Customer_Service 响应类型","errorType":"exception","errorClass":"MessageHandlerException","httpStatus":null,"severity":"error","filePath":"src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/WorkMessageEntityEnlightener.cs","lineNumber":91,"sourceCode":"\n        public override IResponseMessageMusic NewResponseMessageMusic()\n        {\n            throw new MessageHandlerException(\"微信企业号不支持 IResponseMessageMusic 响应类型\");\n        }\n\n        public override IResponseMessageNews NewResponseMessageNews()\n        {\n            return new ResponseMessageNews();\n        }\n\n        public override IResponseMessageText NewResponseMessageText()\n        {\n            return new ResponseMessageText();\n        }\n\n        public override IResponseMessageTransfer_Customer_Service NewResponseMessageTransfer_Customer_Service()\n        {\n            throw new MessageHandlerException(\"微信企业号不支持 IResponseMessageTransfer_Customer_Service 响应类型\");\n        }\n\n        public override IResponseMessageVideo NewResponseMessageVideo()\n        {\n            return new ResponseMessageVideo();\n        }\n\n        public override IResponseMessageVoice NewResponseMessageVoice()\n        {\n            return new ResponseMessageVoice();\n        }\n\n        public override IRequestMessageMiniProgramPage NewRequestMessageMiniProgramPage()\n        {\n            throw new MessageHandlerException(\"微信企业号不支持 IRequestMessageMiniProgramPage 响应类型\");\n        }\n    }\n}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/JeffreySu/WeiXinMPSDK/blob/be573f6f94bdbf718dd5f6cdecb137fbc7ff651e/src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/WorkMessageEntityEnlightener.cs#L73-L109","documentation":"The WeChat Work message handler does not support the Transfer_Customer_Service response type. NewResponseMessageTransfer_Customer_Service() throws MessageHandlerException because WeChat Work has no 'forward to customer service' passive reply; customer service works differently in Work.","triggerScenarios":"Calling NewResponseMessageTransfer_Customer_Service() on a WorkMessageHandler to hand a message off to customer service inside DefaultResponseMessage or an OnXxx handler.","commonSituations":"Porting Official Account customer-service-forwarding logic to WeChat Work; using shared handler code across MP and Work without platform checks.","solutions":["Remove the transfer-to-customer-service reply in Work handlers and reply with a supported type (text/news) instead.","Implement customer service via WeChat Work's own customer-service or app-chat APIs.","Branch on platform so this factory method is only invoked from Senparc.Weixin.MP handlers."],"exampleFix":"// before\nvar resp = requestMessageHandler.CreateResponseMessage<IResponseMessageTransfer_Customer_Service>();\n// after\nvar resp = requestMessageHandler.CreateResponseMessage<IResponseMessageText>();\nresp.Content = \"客服将尽快与您联系\";","handlingStrategy":"fallback","validationCode":"if (handler is Senparc.Weixin.Work.MessageHandlers.WorkMessageHandler<>)\n{\n    // no customer-service transfer in Work — reply with supported type\n    resp = handler.CreateResponseMessage<IResponseMessageText>();\n}","typeGuard":"bool IsWorkHandler(MessageHandler<DefaultWorkMessageContext> h) => h is Senparc.Weixin.Work.MessageHandlers.WorkMessageHandler<DefaultWorkMessageContext>;","tryCatchPattern":"try\n{\n    resp = handler.CreateResponseMessage<IResponseMessageTransfer_Customer_Service>();\n}\ncatch (MessageHandlerException)\n{\n    resp = handler.CreateResponseMessage<IResponseMessageText>();\n}","preventionTips":["Use WeChat Work's own customer-service APIs instead of the MP transfer reply.","Centralize platform-specific reply-type selection behind one factory function."],"tags":["weixin-work","message-handler","unsupported-response-type"],"backgroundTag":"unsupported-operation","analyzedSha":"be573f6f94bdbf718dd5f6cdecb137fbc7ff651e","analyzedAt":"2026-09-12T10:01:50.733Z","contentChangedAt":"2026-09-12T10:01:50.733Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}