收藏
回答

图文素材插入小程序卡片,提示invalid content?

请求一:

请求的接口:https://api.weixin.qq.com/cgi-bin/material/add_news
接口参数: {"articles":[{"thumb_media_id":"0zDYearN6PpOm7nra1_tcuVQ_GfloXbyFNYGXC3d9bM","title":"测试小程序卡片","content":"<p>测试图文小程序</p><p><mp-miniprogram data-miniprogram-appid=\"wxb0fd38c17f4f7580\" data-miniprogram-path=\"pages/home/index\" data-miniprogram-nickname=\"测试\" data-miniprogram-title=\"测试\" data-miniprogram-imageurl=\"http://mmbiz.qpic.cn/mmbiz_png/hfzjfG69vEwFQUMsJsKLW03W5xHkuHmqPavK6ZSd8A6JqToLpcVQEiccVH728gR9rOxunLGj9JlujAcwx3vVANw/0\" ></mp-miniprogram></p>","show_cover_pic":"0"}]}
返回参数: {"errcode":45166,"errmsg":"invalid content hint: [Cq0181d418] rid: 60b04aa5-58fdb722-78f87bf6"}
  


请求二:

请求的接口:https://api.weixin.qq.com/cgi-bin/material/add_news
接口参数: {"articles":[{"thumb_media_id":"0zDYearN6PpOm7nra1_tcuVQ_GfloXbyFNYGXC3d9bM","title":"测试小程序卡片","content":"<p>测试图文小程序</p><p><mp-miniprogram data-miniprogram-appid=\"wxb0fd38c17f4f7580\" data-miniprogram-path=\"pages/home/index\" data-miniprogram-nickname=\"测试\" data-miniprogram-title=\"测试\" data-miniprogram-imageurl=\"http://mmbiz.qpic.cn/mmbiz_jpg/hfzjfG69vEyLHlWn5B4kJYNhOf7L4rk0FWJxMMwD57uAxal8JYdYGY6CKXBKMeOhcAh62jLpTQCRvpADKkJd4A/0?wx_fmt=jpeg\" ></mp-miniprogram></p>","show_cover_pic":"0"}]}
返回参数: {"media_id":"0zDYearN6PpOm7nra1_tctuZD1RUJEV5ZRo4R5h1kvY","item":[]}

请求一提示content非法,请求二成功上传图文素材。两个请求唯一的区别是content字段中data-miniprogram-imageurl的值

请求一的 data-miniprogram-imageurl的值, 是通过接口 “上传图文消息内的图片获取URL” https://api.weixin.qq.com/cgi-bin/media/uploadimg获取

请求二的 data-miniprogram-imageurl的值,是直接从微信公众号后台上传一个带有小程序卡片的图文素材,通过接口入参中提取 data-miniprogram-imageurl ,如下图



最后一次编辑于  2021-05-28
回答关注问题邀请回答
收藏
登录 后发表内容