- 微信公众号消息加解密为何在验签时失败?
我们需要在公众号中对收发的消息进行加密,在公众号中设置了兼容模式进行调试,根据文档https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Message_encryption_and_decryption_instructions.html下载了demo,demo可以正常运行,但是如果把其中的参数改成我们公众号自己的参数,解密时在验签步骤就失败了,代码运行后得到的signature和附带的signature不一样,导致验签失败。 我们使用的语言是C#,原本的代码如下: //公众平台上开发者设置的token, appID, EncodingAESKey string sToken = "QDG6eK"; string sAppID = "wx5823bf96d3bd56c7"; string sEncodingAESKey = "jWmYm7qr5nMoAUwZRjGtBxmz3KA1tkAj3ykkR6q2B2C"; Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(sToken, sEncodingAESKey, sAppID); /* 1. 对用户回复的数据进行解密。 * 用户回复消息或者点击事件响应时,企业会收到回调消息,假设企业收到的推送消息: * POST /cgi-bin/wxpush? msg_signature=477715d11cdb4164915debcba66cb864d751f3e6×tamp=1409659813&nonce=1372623149 HTTP/1.1 Host: qy.weixin.qq.com Content-Length: 613 * * */ string sReqMsgSig = "477715d11cdb4164915debcba66cb864d751f3e6"; string sReqTimeStamp = "1409659813"; string sReqNonce = "1372623149"; string sReqData = ""; string sMsg = ""; //解析之后的明文 int ret = 0; ret = wxcpt.DecryptMsg(sReqMsgSig, sReqTimeStamp, sReqNonce, sReqData, ref sMsg); if (ret != 0) { System.Console.WriteLine("ERR: Decrypt fail, ret: " + ret); return; } System.Console.WriteLine(sMsg); 当把其中的参数sToken,sAppID,sEncodingAESKey,sReqMsgSig,sReqTimeStamp,sReqNonce,sReqData替换成真实推送过来的参数,验签步骤就失败了,失败的原因是代码生成的signature和传递过来的signature不一致 ret = VerifySignature(m_sToken, sTimeStamp, sNonce, sEncryptMsg, sMsgSignature); private static int VerifySignature(string sToken, string sTimeStamp, string sNonce, string sMsgEncrypt, string sSigture) { string hash = ""; int ret = 0; ret = GenarateSinature(sToken, sTimeStamp, sNonce, sMsgEncrypt, ref hash); if (ret != 0) return ret; //System.Console.WriteLine(hash); if (hash == sSigture) return 0; else { return (int)WXBizMsgCryptErrorCode.WXBizMsgCrypt_ValidateSignature_Error; } } 返回的ret结果是-40001,尝试过sToken使用token的名称或者最新的值,都在验签步骤失败,一样的错误。 [图片] 根据文档https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Before_Develop/Technical_Plan.html,消息解密需要用到的数据有timestamp, nonce, msg_signature(来自request.querystring), Encrypt Message(来自Request.InputStream中的密文消息体Encrypt节点), Token(微信开放平台上,服务方设置的接收消息的校验 token)。 验签时根据Token, timestamp, nonce, Encrypt生成signature, 和msg_signature比对完成验签。 请问问题出在哪里?是哪个参数没有设置好? 已解决,是Token参数使用错了,用的是AccessToken,导致生成的签名不一致,使用公众号中设置的Token名称即可。
04-08 - 微信公众号被动消息不回复怎么解决?
在微信公众号里启用了服务器配置,当用户关注/发送消息时,可以正常接收到微信服务器推送的消息,但当解析处理结束完,最后给微信服务器发送的消息没有出现在公众号里。 收到的推送消息如下(ToUserName, FromUserName, MsgId, Encrypt已改成xxxxxxxxxx): 1702020193 xxxxxxxxxxx 发送的是普通文本消息,通过记录日志可以看到发送前的XML是这样的(ToUserName, FromUserName已改成xxxxxxx), 638376296547081065 参考文档 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Passive_user_reply_message.html#0,格式没有问题,from和to的数据也都没有问题,也已经返回给微信服务器了,但就是没有出现在公众号里,也没有任何提示,就好像压根就没有返回要回复的xml,请问这是什么原因造成的? 一旦遇到以下情况,微信都会在公众号会话中,向用户下发系统提示“该公众号暂时无法提供服务,请稍后再试”: 1、开发者在5秒内未回复任何内容 2、开发者回复了异常数据,比如JSON数据等 如果回复超时了,应该显示提示,可现在的情况是没有提示信息。
2023-12-08 - 调用新建草稿的API,传入的content是html, 为何样式会乱?
根据文档 https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html content 是图文消息的具体内容,支持HTML标签,必须少于2万字符,小于1M,且此处会去除JS,涉及图片url必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片url将被过滤。 我在调用新建草稿的API时,设置参数content为一段网页的html源码(不包含js),并将双引号改成单引号(双引号通不过,会报invalid media id的错误),成功新建了草稿。但当我从微信公众号后台打开这个草稿时,发现样式完全不对。 看文档content是支持html标签的,可为何传入的html显示出来的效果和原网页完全不一样?不是说支持html吗?为何上传后的html和上传前差别这么大? 上传前html长这样 [图片] 上传到草稿后长这样 [图片] 附html源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Email Subject</title> <meta name="referrer" content="never"> <meta name="format-detection" content="telephone=no,date=no,address=no,email=no"> <meta name="x-apple-disable-message-reformatting"> <meta type="xrm/designer/setting" name="type" value="marketing-designer-content-editor-document"> <meta type="xrm/designer/setting" name="layout-editable" value="marketing-designer-layout-editable"> <meta type="xrm/designer/setting" name="layout-max-width" value="600px" datatype="text" label="Layout max width"> <style> :root { --brand-color1: #5900fe; --brand-color2: #330099; --brand-color3: #e1dfdd; --brand-color4: #666666; --brand-color5: #cccccc; --brand-color6: #333333; --brand-color7: #0082dd; --brand-color8: #0742ab; --brand-color9: #494949; } body { font-family: Arial, Verdana, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); } h1 { color: rgb(0, 0, 0); font-size: 34px; font-weight: normal; font-family: Verdana, Arial, sans-serif; line-height: inherit; text-align: left; } h2 { color: rgb(51, 51, 51); font-size: 24px; font-weight: normal; font-family: sans-serif; line-height: inherit; text-align: left; } h3 { color: rgb(0, 0, 0); font-size: 16px; font-weight: normal; font-family: Verdana, Arial, sans-serif; line-height: inherit; text-align: left; } p { font-family: Arial, Verdana, sans-serif; font-size: 14px; color: rgb(0, 0, 0); line-height: inherit; font-weight: normal; text-align: left; } a { font-family: Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; color: rgb(0, 130, 221); text-decoration: none; } .buttonWrapper { margin: 10px 0px; } .buttonClass { font-family: Arial, Verdana, sans-serif; font-size: 16px; font-weight: normal; border-radius: 4px; color: white; border: none; background-color: rgb(7, 66, 171); padding: 10px 20px; text-decoration: none; } .buttonClass span { font-family: inherit; text-decoration: inherit; } .divider { border-top: 2px solid silver; margin: 10px 0px; width: 100%; } div div { background-color: transparent; } [data-layout="true"] { border: none; margin: 0px auto; background-color: rgb(255, 255, 255); max-width: /* @layout-max-width */ 600px /* @layout-max-width */ ; } </style> </head> <body><div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer" cellpadding="0" cellspacing="0"> <tbody> <tr> <th class="columnContainer" style="vertical-align:top; min-width: 5px; width: 580px; ; height: 0px;" id="containerdc430676a1331697082378581"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="text-align:left;min-width:5px;padding:10px;vertical-align:top;word-wrap:break-word;word-break:break-word;font-weight:400"> <div data-editorblocktype="Divider" style="margin-right: 10px; margin-bottom: 20px; margin-left: 10px;"> <div class="dividerWrapper" align="center"> <table style="padding: 0px; margin: 0px; width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0"> <tbody> <tr style="padding: 0px;"> <th style="margin:0px; padding: 0px; vertical-align:top;border-top-width: 2px; border-top-style: solid; border-top-color: #e1dfdd;"> <p style="margin: 0px; padding: 0px; line-height: 0px; width: 100%;"> <span><!--[if gte mso 9]><br/><![endif]--> </span> </p> </th> </tr> </tbody> </table> </div> </div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div> <div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer multi" cellpadding="0" cellspacing="0"> <tbody> <tr> <th data-container="true" class="columnContainer" data-container-width="50.00" style="vertical-align: top; min-width: 5px; width: 290px; height: 0px;" id="container6f54de0bb96741697082433235"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="min-width: 5px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Image" style="margin: 10px;"> <div align="center" class="imageWrapper" style="width: 100%;" width="100%"> <div class="clear" style="clear: both; height: 0px; width: 0px;"> </div> </div> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p style="margin-bottom:18px"> <span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US"><span style="font-family:"Georgia",serif"><span style="color:#5900fe">Critical Thinking Program<br><i>(for ages 9-14)</i></span></span></span></b></span></span> </p> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p><b><span lang="EN-US" style="font-size:10.5pt"><span style="font-family:"Arial",sans-serif"><span style="color:black">Master critical and lateral thinking skills and explore current affairs in preparation for local to international school transition, IB research, in-depth investigation in A Levels and DSE Liberal Studies.</span></span></span></b> </p> </div> </th> </tr> </tbody> </table> </th> <th data-container="true" class="columnContainer" data-container-width="50.00" style="vertical-align: top; min-width: 5px; width: 290px; height: 0px;" id="container5b163b96e1aad1697082767606"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="columnContainer inner" style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px; min-width: 5px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Image" style="margin: 10px;"> <div align="center" class="imageWrapper" data-image-file-id="3884883c-b268-ee11-9ae7-002248ecf784" width="100%" style="width: 100%;"> <div class="clear" style="clear: both; height: 0px; width: 0px;"> </div> </div> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p style="margin-bottom:18px"> <span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US"><span style="font-family:"Georgia",serif"><span style="color:#5900fe">Reading & Writing Program<br><i>(for ages 7-14)</i></span></span></span></b></span></span> </p> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p><b><span lang="EN-US" style="font-size:10.5pt"><span style="font-family:"Arial",sans-serif"><span style="color:black">Our integrated Reading & Writing Program (Junior, Intermediate and Advanced levels) where our Enrichment teachers will assess the students' language and writing skills and identify areas for improvement in their coming school year. </span></span></span></b> </p> </div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div> <div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer" cellpadding="0" cellspacing="0"> <tbody> <tr> <th data-container="true" class="columnContainer" data-container-width="100.00" style="vertical-align: top; min-width: 5px; width: 580px; height: 0px;" id="containerac3fd2f7fc9f61697091556086"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="min-width: 5px; padding: 10px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Button" align="center" class="buttonWrapper"><a class="buttonClass" href="https://www.baidu.com" style="display: table-cell; width: 520px; height: 18px; max-width: 100%; line-height: normal; vertical-align: middle; background-color: rgb(51, 0, 153); mso-hide: none !important;" data-msdyn-tracking-id="1ccaf699039311697083426080"> <span style="display: inline-block; min-width: 1px;">PROGRAM DETAILS</span> </a></div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div></body></html>
2023-11-22 - 调用新建草稿的API,传入的content是html, 为何样式会乱?
根据文档 https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html content 是图文消息的具体内容,支持HTML标签,必须少于2万字符,小于1M,且此处会去除JS,涉及图片url必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片url将被过滤。 我在调用新建草稿的API时,设置参数content为一段网页的html源码(不包含js),并将双引号改成单引号(双引号通不过,会报invalid media id的错误),成功新建了草稿。但当我从微信公众号后台打开这个草稿时,发现样式完全不对。 看文档content是支持html标签的,可为何传入的html显示出来的效果和原网页完全不一样? 上传前部分html长这样 [图片] 上传到微信公众号草稿变这样 [图片] 就算没有图片,样式差的这么离谱。不是说支持html吗?为何上传后的html和上传前差别这么大? 附html源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Email Subject</title> <meta name="referrer" content="never"> <meta name="format-detection" content="telephone=no,date=no,address=no,email=no"> <meta name="x-apple-disable-message-reformatting"> <meta type="xrm/designer/setting" name="type" value="marketing-designer-content-editor-document"> <meta type="xrm/designer/setting" name="layout-editable" value="marketing-designer-layout-editable"> <meta type="xrm/designer/setting" name="layout-max-width" value="600px" datatype="text" label="Layout max width"> <style> :root { --brand-color1: #5900fe; --brand-color2: #330099; --brand-color3: #e1dfdd; --brand-color4: #666666; --brand-color5: #cccccc; --brand-color6: #333333; --brand-color7: #0082dd; --brand-color8: #0742ab; --brand-color9: #494949; } body { font-family: Arial, Verdana, sans-serif; font-size: 14px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); } h1 { color: rgb(0, 0, 0); font-size: 34px; font-weight: normal; font-family: Verdana, Arial, sans-serif; line-height: inherit; text-align: left; } h2 { color: rgb(51, 51, 51); font-size: 24px; font-weight: normal; font-family: sans-serif; line-height: inherit; text-align: left; } h3 { color: rgb(0, 0, 0); font-size: 16px; font-weight: normal; font-family: Verdana, Arial, sans-serif; line-height: inherit; text-align: left; } p { font-family: Arial, Verdana, sans-serif; font-size: 14px; color: rgb(0, 0, 0); line-height: inherit; font-weight: normal; text-align: left; } a { font-family: Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; color: rgb(0, 130, 221); text-decoration: none; } .buttonWrapper { margin: 10px 0px; } .buttonClass { font-family: Arial, Verdana, sans-serif; font-size: 16px; font-weight: normal; border-radius: 4px; color: white; border: none; background-color: rgb(7, 66, 171); padding: 10px 20px; text-decoration: none; } .buttonClass span { font-family: inherit; text-decoration: inherit; } .divider { border-top: 2px solid silver; margin: 10px 0px; width: 100%; } div div { background-color: transparent; } [data-layout="true"] { border: none; margin: 0px auto; background-color: rgb(255, 255, 255); max-width: /* @layout-max-width */ 600px /* @layout-max-width */ ; } </style> </head> <body><div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer" cellpadding="0" cellspacing="0"> <tbody> <tr> <th class="columnContainer" style="vertical-align:top; min-width: 5px; width: 580px; ; height: 0px;" id="containerdc430676a1331697082378581"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="text-align:left;min-width:5px;padding:10px;vertical-align:top;word-wrap:break-word;word-break:break-word;font-weight:400"> <div data-editorblocktype="Divider" style="margin-right: 10px; margin-bottom: 20px; margin-left: 10px;"> <div class="dividerWrapper" align="center"> <table style="padding: 0px; margin: 0px; width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0"> <tbody> <tr style="padding: 0px;"> <th style="margin:0px; padding: 0px; vertical-align:top;border-top-width: 2px; border-top-style: solid; border-top-color: #e1dfdd;"> <p style="margin: 0px; padding: 0px; line-height: 0px; width: 100%;"> <span><!--[if gte mso 9]><br/><![endif]--> </span> </p> </th> </tr> </tbody> </table> </div> </div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div> <div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer multi" cellpadding="0" cellspacing="0"> <tbody> <tr> <th data-container="true" class="columnContainer" data-container-width="50.00" style="vertical-align: top; min-width: 5px; width: 290px; height: 0px;" id="container6f54de0bb96741697082433235"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="min-width: 5px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Image" style="margin: 10px;"> <div align="center" class="imageWrapper" style="width: 100%;" width="100%"> <div class="clear" style="clear: both; height: 0px; width: 0px;"> </div> </div> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p style="margin-bottom:18px"> <span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US"><span style="font-family:"Georgia",serif"><span style="color:#5900fe">Critical Thinking Program<br><i>(for ages 9-14)</i></span></span></span></b></span></span> </p> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p><b><span lang="EN-US" style="font-size:10.5pt"><span style="font-family:"Arial",sans-serif"><span style="color:black">Master critical and lateral thinking skills and explore current affairs in preparation for local to international school transition, IB research, in-depth investigation in A Levels and DSE Liberal Studies.</span></span></span></b> </p> </div> </th> </tr> </tbody> </table> </th> <th data-container="true" class="columnContainer" data-container-width="50.00" style="vertical-align: top; min-width: 5px; width: 290px; height: 0px;" id="container5b163b96e1aad1697082767606"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="columnContainer inner" style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px; min-width: 5px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Image" style="margin: 10px;"> <div align="center" class="imageWrapper" data-image-file-id="3884883c-b268-ee11-9ae7-002248ecf784" width="100%" style="width: 100%;"> <div class="clear" style="clear: both; height: 0px; width: 0px;"> </div> </div> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p style="margin-bottom:18px"> <span style="font-size:16px;"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US"><span style="font-family:"Georgia",serif"><span style="color:#5900fe">Reading & Writing Program<br><i>(for ages 7-14)</i></span></span></span></b></span></span> </p> </div> <div data-editorblocktype="Text" style="margin: 10px;"> <p><b><span lang="EN-US" style="font-size:10.5pt"><span style="font-family:"Arial",sans-serif"><span style="color:black">Our integrated Reading & Writing Program (Junior, Intermediate and Advanced levels) where our Enrichment teachers will assess the students' language and writing skills and identify areas for improvement in their coming school year. </span></span></span></b> </p> </div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div> <div data-section="true" class="emptyContainer columns-equal-class wrap-section"> <table class="outer" align="center" cellpadding="0" cellspacing="0" style="width: 600px; display: block;"> <tbody> <tr> <th style="padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"> <table style=" width: 100%; border-collapse: collapse; " class="containerWrapper tbContainer" cellpadding="0" cellspacing="0"> <tbody> <tr> <th data-container="true" class="columnContainer" data-container-width="100.00" style="vertical-align: top; min-width: 5px; width: 580px; height: 0px;" id="containerac3fd2f7fc9f61697091556086"> <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%;"> <tbody> <tr> <th class="inner" style="min-width: 5px; padding: 10px; vertical-align: top; word-wrap: break-word; word-break: break-word; font-weight: normal;"> <div data-editorblocktype="Button" align="center" class="buttonWrapper"><a class="buttonClass" href="https://www.baidu.com" style="display: table-cell; width: 520px; height: 18px; max-width: 100%; line-height: normal; vertical-align: middle; background-color: rgb(51, 0, 153); mso-hide: none !important;" data-msdyn-tracking-id="1ccaf699039311697083426080"> <span style="display: inline-block; min-width: 1px;">PROGRAM DETAILS</span> </a></div> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </th> </tr> </tbody> </table> </div></body></html>
2023-11-16 - 调用微信API创建草稿箱,为什么设置的临时素材无效?
参考文档https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html 其中参数thumb_media_id是图文消息的封面图片素材id(必须是永久MediaID) 创建新的草稿箱,其中的参数thumb_media_id设置成上传的临时素材id(现在已经不能通过API上传永久素材了,所以这里只能上传临时素材,上传的临时素材在公众号后台又找不到)。 调用API创建草稿箱时报错 错误代码: 40007, 错误信息: invalid media_id hint: [0rXo80521p504] rid: 65533789-61d6f1ca-39da0b94 这个问题该如何解决?如果我没理解错的话,看起来是矛盾的,创建草稿箱必须使用永久素材,而永久素材现在又不能通过API创建。
2023-11-14