Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Send Mini-Program #1806

Open
limingth opened this issue Jul 4, 2019 · 5 comments

Comments

@limingth
Copy link

commented Jul 4, 2019

As #1678 has pioneered to help wechaty-puppet-padpro be able to send wechat mini-program using xml within <msg>, we want to continue this work to get it really done.

Here is what we find and achieve.

A sample of msg raw data

{
  "id": "1099177530",
  "timestamp": 1562210085,
  "type": 9,
  "filename": "1099177530-to-be-implement.txt",
  "fromId": "wxid_jy0q2q63aggm21",
  "roomId": "8397442379@chatroom",
  "text": "<?xml version=\"1.0\"?>\n<msg>\n\t<appmsg appid=\"\" sdkver=\"0\">\n\t\t<title>毛豆课堂-专注于少儿领域的在线教育平台</title>\n\t\t<des>毛豆课堂</des>\n\t\t<action />\n\t\t<type>33</type>\n\t\t<showtype>0</showtype>\n\t\t<soundtype>0</soundtype>\n\t\t<mediatagname />\n\t\t<messageext />\n\t\t<messageaction />\n\t\t<content />\n\t\t<contentattr>0</contentattr>\n\t\t<url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxe638e634ed8b3907&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url>\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<appattach>\n\t\t\t<totallen>0</totallen>\n\t\t\t<attachid />\n\t\t\t<emoticonmd5 />\n\t\t\t<fileext />\n\t\t\t<cdnthumburl>30590201000452305002010002043591c1e102032f4f560204e87ac2dc02045d1d6f24042b777875706c6f61645f383339373434323337394063686174726f6f6d313439345f313536323231303038340204010400030201000400</cdnthumburl>\n\t\t\t<cdnthumbmd5>bc3adb4160b6cbbac4be374b2acae80d</cdnthumbmd5>\n\t\t\t<cdnthumblength>7453</cdnthumblength>\n\t\t\t<cdnthumbwidth>720</cdnthumbwidth>\n\t\t\t<cdnthumbheight>576</cdnthumbheight>\n\t\t\t<cdnthumbaeskey>f922a8fbce1e7c3a8627dc2a9678f455</cdnthumbaeskey>\n\t\t\t<aeskey>f922a8fbce1e7c3a8627dc2a9678f455</aeskey>\n\t\t\t<encryver>0</encryver>\n\t\t\t<filekey>8397442379@chatroom1494_1562210084</filekey>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<sourceusername>gh_a1cd71094745@app</sourceusername>\n\t\t<sourcedisplayname>毛豆课堂</sourcedisplayname>\n\t\t<thumburl />\n\t\t<md5 />\n\t\t<statextstr />\n\t\t<weappinfo>\n\t\t\t<username><![CDATA[gh_a1cd71094745@app]]></username>\n\t\t\t<appid><![CDATA[wxe638e634ed8b3907]]></appid>\n\t\t\t<type>2</type>\n\t\t\t<version>19</version>\n\t\t\t<weappiconurl><![CDATA[http://mmbiz.qpic.cn/mmbiz_png/5lFWgxHFPzeu01RyEibY7vb5iceGcpBu9mReAHiaiaoXF7BicEYNSM2HretSX7DUa9CmASvspmiaSPDhIWm4w7nibXlQw/640?wx_fmt=png&wxfrom=200]]></weappiconurl>\n\t\t\t<pagepath><![CDATA[pages/index/index.html?userId=5cff40a739b221001136af8a]]></pagepath>\n\t\t\t<shareId><![CDATA[0_wxe638e634ed8b3907_898744801_1562210083_0]]></shareId>\n\t\t\t<appservicetype>0</appservicetype>\n\t\t</weappinfo>\n\t</appmsg>\n\t<fromusername>wxid_jy0q2q63aggm21</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>1</version>\n\t\t<appname></appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>\n",
  "toId": "wxid_3kxyh21gj3gt22"
}

XML data of mini-program in "text"

<?xml version="1.0"?>
<msg>
	<appmsg appid="" sdkver="0">
		<title>毛豆课堂-专注于少儿领域的在线教育平台</title>
		<des>毛豆课堂</des>
		<action />
		<type>33</type>
		<showtype>0</showtype>
		<soundtype>0</soundtype>
		<mediatagname />
		<messageext />
		<messageaction />
		<content />
		<contentattr>0</contentattr>
		<url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxe638e634ed8b3907&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url>
		<lowurl />
		<dataurl />
		<lowdataurl />
		<appattach>
			<totallen>0</totallen>
			<attachid />
			<emoticonmd5 />
			<fileext />
			<cdnthumburl>30590201000452305002010002043591c1e102032f4f560204e87ac2dc02045d1d6f24042b777875706c6f61645f383339373434323337394063686174726f6f6d313439345f313536323231303038340204010400030201000400</cdnthumburl>
			<cdnthumbmd5>bc3adb4160b6cbbac4be374b2acae80d</cdnthumbmd5>
			<cdnthumblength>7453</cdnthumblength>
			<cdnthumbwidth>720</cdnthumbwidth>
			<cdnthumbheight>576</cdnthumbheight>
			<cdnthumbaeskey>f922a8fbce1e7c3a8627dc2a9678f455</cdnthumbaeskey>
			<aeskey>f922a8fbce1e7c3a8627dc2a9678f455</aeskey>
			<encryver>0</encryver>
			<filekey>8397442379@chatroom1494_1562210084</filekey>
		</appattach>
		<extinfo />
		<sourceusername>gh_a1cd71094745@app</sourceusername>
		<sourcedisplayname>毛豆课堂</sourcedisplayname>
		<thumburl />
		<md5 />
		<statextstr />
		<weappinfo>
			<username><![CDATA[gh_a1cd71094745@app]]></username>
			<appid><![CDATA[wxe638e634ed8b3907]]></appid>
			<type>2</type>
			<version>19</version>
			<weappiconurl><![CDATA[http://mmbiz.qpic.cn/mmbiz_png/5lFWgxHFPzeu01RyEibY7vb5iceGcpBu9mReAHiaiaoXF7BicEYNSM2HretSX7DUa9CmASvspmiaSPDhIWm4w7nibXlQw/640?wx_fmt=png&wxfrom=200]]></weappiconurl>
			<pagepath><![CDATA[pages/index/index.html?userId=5cff40a739b221001136af8a]]></pagepath>
			<shareId><![CDATA[0_wxe638e634ed8b3907_898744801_1562210083_0]]></shareId>
			<appservicetype>0</appservicetype>
		</weappinfo>
	</appmsg>
	<fromusername>wxid_jy0q2q63aggm21</fromusername>
	<scene>0</scene>
	<appinfo>
		<version>1</version>
		<appname></appname>
	</appinfo>
	<commenturl></commenturl>
</msg>

Difference between Two Persons shared the same mini-program

lideMacBook:new-bot liming$ diff 1.xml 2.xml 
24c24
< 			<cdnthumburl>30590201000452305002010002043591c1e102032f4f560204e87ac2dc02045d1d6f24042b777875706c6f61645f383339373434323337394063686174726f6f6d313439345f313536323231303038340204010400030201000400</cdnthumburl>
---
> 			<cdnthumburl>30590201000452305002010002040887ff9302033d11fd0204aae2e26502045d1c785e042b777875706c6f61645f31393239323537323331384063686174726f6f6d3134305f313536323134363931300204010400030201000400</cdnthumburl>
29,30c29,30
< 			<cdnthumbaeskey>f922a8fbce1e7c3a8627dc2a9678f455</cdnthumbaeskey>
< 			<aeskey>f922a8fbce1e7c3a8627dc2a9678f455</aeskey>
---
> 			<cdnthumbaeskey>204c2fbceb186dcd38d23901cf9a75e6</cdnthumbaeskey>
> 			<aeskey>204c2fbceb186dcd38d23901cf9a75e6</aeskey>
32c32
< 			<filekey>8397442379@chatroom1494_1562210084</filekey>
---
> 			<filekey>8397442379@chatroom1572_1562216333</filekey>
51c51
< 	<fromusername>wxid_jy0q2q63aggm21</fromusername>
---
> 	<fromusername>akae_teacher_li</fromusername>

Difference between One Person shared the same mini-program twice

lideMacBook:new-bot liming$ diff 2.xml 3.xml 
32c32
< 			<filekey>8397442379@chatroom1572_1562216333</filekey>
---
> 			<filekey>8397442379@chatroom1575_1562217463</filekey>

What we GUESS due to unknown wechat XML protocol

  1. We guess filekey is combined by these 3 fields
<roomId><msg_count>_<timestamp>

for example: <filekey>8397442379@chatroom1572_1562216333</filekey>

  • roomId: 8397442379@chatroom
  • msg_count: 1572
  • timestamp: 156221633
  1. We guess that commented filekey needs to-be-fixed in message-app-payload-parser.ts
  interface XmlSchema {
    msg: {
      appmsg: {
        $: {
          appid: string,
          sdkver: string,
        },
        title: string,
        des: string,
        type: string,
        url: string,
        appattach: {
          totallen: string,
          attachid: string,
          emoticonmd5: string,
          fileext: string,
          cdnattachurl: string,
          cdnthumburl: string,
          cdnthumbmd5: string,
          cdnthumblength: string,
          cdnthumbwidth: string,
          cdnthumbheight: string,
          cdnthumbaeskey: string,
          aeskey: string,
          encryver: string,
          islargefilemsg: string,
          // filekey: string,
        },

Help wanted

However, we are very new hands on this low-level code, especially in this important feature.
Anyone could help? Please follow this issue or add my wechat ID: limingth

@huan

This comment has been minimized.

Copy link
Member

commented Jul 4, 2019

@limingth Thanks for creating this issue for better discussing effort based on GitHub!

Could you please change the picture to text so that it could be searchable, and better display?

@limingth

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

XML data with Page Path of mini-program

<?xml version="1.0"?>
<msg>
	<appmsg appid="" sdkver="0">
		<title>下午例会</title>
		<des />
		<action />
		<type>33</type>
		<showtype>0</showtype>
		<soundtype>0</soundtype>
		<mediatagname />
		<messageext />
		<messageaction />
		<content />
		<contentattr>0</contentattr>
		<url>https://mp.weixin.qq.com/mp/waerrpage?appid=wxe638e634ed8b3907&amp;type=upgrade&amp;upgradetype=3#wechat_redirect</url>
		<lowurl />
		<dataurl />
		<lowdataurl />
		<appattach>
			<totallen>0</totallen>
			<attachid />
			<emoticonmd5 />
			<fileext />
			<cdnthumburl>30590201000452305002010002043591c1e102032f4f5602041b7ac2dc02045d1dc42d042b777875706c6f61645f383339373434323337394063686174726f6f6d313535325f313536323233313835330204010400030201000400</cdnthumburl>
			<cdnthumbmd5>505a8043e37721525b04b6b5ce104071</cdnthumbmd5>
			<cdnthumblength>48115</cdnthumblength>
			<cdnthumbwidth>720</cdnthumbwidth>
			<cdnthumbheight>576</cdnthumbheight>
			<cdnthumbaeskey>db57f89df26242846a1da1adbc9d8291</cdnthumbaeskey>
			<aeskey>db57f89df26242846a1da1adbc9d8291</aeskey>
			<encryver>0</encryver>
			<filekey>8397442379@chatroom1617_1562232039</filekey>
		</appattach>
		<extinfo />
		<sourceusername>gh_a1cd71094745@app</sourceusername>
		<sourcedisplayname>毛豆课堂</sourcedisplayname>
		<thumburl />
		<md5 />
		<statextstr />
		<weappinfo>
			<username><![CDATA[gh_a1cd71094745@app]]></username>
			<appid><![CDATA[wxe638e634ed8b3907]]></appid>
			<type>2</type>
			<version>19</version>
			<weappiconurl><![CDATA[http://mmbiz.qpic.cn/mmbiz_png/5lFWgxHFPzeu01RyEibY7vb5iceGcpBu9mReAHiaiaoXF7BicEYNSM2HretSX7DUa9CmASvspmiaSPDhIWm4w7nibXlQw/640?wx_fmt=png&wxfrom=200]]></weappiconurl>
			<pagepath><![CDATA[pages/course/detail/detail.html?id=5d1051aea9a9d20011c9a218&userId=5cff40a739b221001136af8a]]></pagepath>
			<shareId><![CDATA[0_wxe638e634ed8b3907_898744801_1562231852_0]]></shareId>
			<appservicetype>0</appservicetype>
		</weappinfo>
	</appmsg>
	<fromusername>akae_teacher_li</fromusername>
	<scene>0</scene>
	<appinfo>
		<version>1</version>
		<appname></appname>
	</appinfo>
	<commenturl></commenturl>
</msg>

Difference between Two Pages in mini-program sharing

lideMacBook:new-bot liming$ diff page1.xml  page2.xml 
4c4
< 		<title>毛豆直播</title>
---
> 		<title>下午例会</title>
24,26c24,26
< 			<cdnthumburl>30590201000452305002010002043331cb4802032f4f560204107ac2dc02045d1dc5e1042b777875706c6f61645f383339373434323337394063686174726f6f6d313632315f313536323233323238390204010400030201000400</cdnthumburl>
< 			<cdnthumbmd5>be645b2a50c4605a39fd0c803a2bb5ac</cdnthumbmd5>
< 			<cdnthumblength>54979</cdnthumblength>
---
> 			<cdnthumburl>30590201000452305002010002043591c1e102032f4f5602041b7ac2dc02045d1dc42d042b777875706c6f61645f383339373434323337394063686174726f6f6d313535325f313536323233313835330204010400030201000400</cdnthumburl>
> 			<cdnthumbmd5>505a8043e37721525b04b6b5ce104071</cdnthumbmd5>
> 			<cdnthumblength>48115</cdnthumblength>
29,30c29,30
< 			<cdnthumbaeskey>b5e4578302ddd14db87b8eb7a6e6fa63</cdnthumbaeskey>
< 			<aeskey>b5e4578302ddd14db87b8eb7a6e6fa63</aeskey>
---
> 			<cdnthumbaeskey>db57f89df26242846a1da1adbc9d8291</cdnthumbaeskey>
> 			<aeskey>db57f89df26242846a1da1adbc9d8291</aeskey>
32c32
< 			<filekey>8397442379@chatroom1621_1562232289</filekey>
---
> 			<filekey>8397442379@chatroom1617_1562232039</filekey>
46,47c46,47
< 			<pagepath><![CDATA[pages/course/detail/detail.html?id=5d1c7916dff37e0011482a74&userId=5d03518eb902b2001146ad04]]></pagepath>
< 			<shareId><![CDATA[0_wxe638e634ed8b3907_858901320_1562232287_0]]></shareId>
---
> 			<pagepath><![CDATA[pages/course/detail/detail.html?id=5d1051aea9a9d20011c9a218&userId=5cff40a739b221001136af8a]]></pagepath>
> 			<shareId><![CDATA[0_wxe638e634ed8b3907_898744801_1562231852_0]]></shareId>
@limingth

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

@limingth Thanks for creating this issue for better discussing effort based on GitHub!

Could you please change the picture to text so that it could be searchable, and better display?

@huan Sure, I've changed the pic to text.

Good News, Now we have tried hard-code to send mini-program in padpro successfully. :)

Thanks to @lhr0909 's creative commit xanthous-tech/wechaty-puppet-padpro@057927c

image

@huan huan pinned this issue Jul 5, 2019

@huan huan referenced this issue Jul 20, 2019

Merged

Send MiniProgram using PadPro #1822

0 of 2 tasks complete
@huan

This comment has been minimized.

Copy link
Member

commented Jul 20, 2019

Wechaty v0.27.59 or above will include the above PRs.

@huan

This comment has been minimized.

Copy link
Member

commented Aug 1, 2019

@limingth Could we close this issue since we had merged & published the related pull requests?

@huan huan unpinned this issue Aug 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.