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

Add support for send url rich media message #718

Closed
binsee opened this issue Aug 10, 2017 · 27 comments
Closed

Add support for send url rich media message #718

binsee opened this issue Aug 10, 2017 · 27 comments

Comments

@binsee
Copy link

binsee commented Aug 10, 2017

You can now use MediaMessage to send any type of file (See #714 ), but you do not yet support send rich media message of the url type.

Url type message:

image

@binsee binsee changed the title Add support for send url rich media information Add support for send url rich media message Aug 10, 2017
@lijiarui
Copy link
Member

thanks! waiting for your pr!

@lijiarui
Copy link
Member

@ashu-22
Copy link

ashu-22 commented Aug 10, 2017

can you please provide me any assistance for this!

@binsee
Copy link
Author

binsee commented Aug 10, 2017

@ashu-22 try doing

@ashu-22
Copy link

ashu-22 commented Aug 10, 2017

how ?

@binsee
Copy link
Author

binsee commented Aug 10, 2017

@ashu-22 Just beginning, still in the analysis

@ashu-22
Copy link

ashu-22 commented Aug 10, 2017

I am in the position to not find the result.Still, I have got so many error's

@binsee
Copy link
Author

binsee commented Aug 11, 2017

@ashu-22 Can now do the local display, but the other side can not receive, suspected server-side to do the filter

image

@ashu-22
Copy link

ashu-22 commented Aug 12, 2017

How ? I have some problem When I try to run that 6 lines of JS code in Node.js
It is not working very well.Even, they did not show me any single error that I was looking out for.
Could you tell me What kind of approach I should be followed there to working on this Local Display?

@binsee
Copy link
Author

binsee commented Aug 12, 2017

@ashu-22 This is my dev branch, is't master branch.

@binsee
Copy link
Author

binsee commented Aug 12, 2017

Because it is still in the test, so there is no push branch.
Do you need to look at the test code?

@ashu-22
Copy link

ashu-22 commented Aug 12, 2017

Yes, Where is it? In which line number.So, I could look out on my own.

@binsee
Copy link
Author

binsee commented Aug 12, 2017

Want to cry......
Before using git stash to save, now use git stash to cause overrides...

@binsee
Copy link
Author

binsee commented Aug 12, 2017

@ashu-22 come back...

binsee@627edf6

@huan
Copy link
Member

huan commented Aug 26, 2017

Did we get the conclusion that whether it's possible for Web API to do this?

@lijiarui
Copy link
Member

Hi @binsee here is some tips, I don't know whether it can help:

get the url message

{
    "Status": 3, 
    "CreateTime": 1503586735, 
    "NewMsgId": 2119214957243756500, 
    "ToUserName": "wxid_ofgv2ps2lznx22", 
    "MsgType": 49, 
    "ImgStatus": 2, 
    "MsgId": 1074572078, 
    "MsgSource": "", 
    "PushContent": "李佳芮 : [链接]一张图看懂Tichome问问音箱2017新品发布会", 
    "Content": "<?xml version=\"1.0\"?>
<msg>
	<appmsg appid=\"\" sdkver=\"0\">
		<title>一张图看懂Tichome问问音箱2017新品发布会</title>
		<des>只要你说,Hi, 小问。「你说,我做」</des>
		<action />
		<type>5</type>
		<showtype>0</showtype>
		<soundtype>0</soundtype>
		<mediatagname />
		<messageext />
		<messageaction />
		<content />
		<contentattr>0</contentattr>
		<url>http://mp.weixin.qq.com/s?__biz=MjM5MTk4MzkyMA==&mid=2247484875&idx=1&sn=52bb67911b950368d8b640cf0c837b1d&chksm=a6ac759491dbfc8204191875608ecac7c7d0ceea4a37d0953c54b332bb262276cfc9f1508080&mpshare=1&scene=1&srcid=0824iznZcv3IFj4f67yfuiNc#rd</url>
		<lowurl />
		<dataurl />
		<lowdataurl />
		<appattach>
			<totallen>0</totallen>
			<attachid />
			<emoticonmd5 />
			<fileext />
			<cdnthumburl>304c020100044530430201000204071638eb02033d0af802046f30feb60204599ebeb90421353639343938393932364063686174726f6f6d3938355f313530333537353733370201000201000400</cdnthumburl>
			<cdnthumbmd5>fee4c3e149ccc3404c5747024f137fcd</cdnthumbmd5>
			<cdnthumblength>3855</cdnthumblength>
			<cdnthumbwidth>160</cdnthumbwidth>
			<cdnthumbheight>160</cdnthumbheight>
			<cdnthumbaeskey>1bd2890a9d5a450a9f07b91ee5d4efa8</cdnthumbaeskey>
			<aeskey>1bd2890a9d5a450a9f07b91ee5d4efa8</aeskey>
			<encryver>0</encryver>
		</appattach>
		<extinfo />
		<sourceusername>gh_8b94c9922bc1</sourceusername>
		<sourcedisplayname>出门问问</sourcedisplayname>
		<thumburl>http://mmbiz.qpic.cn/mmbiz_jpg/Fe1AUOSm6FzsKEWYfOf023rGuYxTfOyPobAEADfPzKg5Djibj5OeWDAEgATX4OvgCkvVDXp4uRZ6qjseXp5ZiaLw/300?wx_fmt=jpeg&wxfrom=1</thumburl>
		<md5 />
		<statextstr />
	</appmsg>
	<fromusername>qq512436430</fromusername>
	<scene>0</scene>
	<appinfo>
		<version>1</version>
		<appname></appname>
	</appinfo>
	<commenturl></commenturl>
</msg>
", 
    "FromUserName": "qq512436430", 
    "account": "1503579784924"
}

If you want to send via iPad, you need the following parameter:

 "title": "一张图看懂Tichome问问音箱2017新品发布会",
      "des": "只要你说,Hi, 小问。「你说,我做」",
      "url": "http://mp.weixin.qq.com/s?__biz=MjM5MTk4MzkyMA==&amp;mid=2247484875&amp;idx=1&amp;sn=52bb67911b950368d8b640cf0c837b1d&amp;chksm=a6ac759491dbfc8204191875608ecac7c7d0ceea4a37d0953c54b332bb262276cfc9f1508080&amp;mpshare=1&amp;scene=1&amp;srcid=0824iznZcv3IFj4f67yfuiNc#rd<",
      "cdnthumburl": "304c020100044530430201000204071638eb02033d0af802046f30feb60204599ebeb90421353639343938393932364063686174726f6f6d3938355f313530333537353733370201000201000400",
      "cdnthumbmd5": "fee4c3e149ccc3404c5747024f137fcd",
      "cdnthumblength": "3855",
      "cdnthumbheight": "160",
      "cdnthumbaeskey":"1bd2890a9d5a450a9f07b91ee5d4efa8",

@binsee
Copy link
Author

binsee commented Aug 27, 2017

@lijiarui

Sorry, I have been tested again and still can not send the url. Suspected for server-side restriction When sending appmsg, only the APPMSGTYPE_ATTACH type message (type number is 6) is allowed.

But accidentally found a few interesting places:

  1. When sending a file, you can change the thumbnail icon of the sent file. (Need to get new thumbnails in advance with id and aeskey)
  2. appmsg can customize the source app displayed in the message

test

The test method is to make a post request directly in fiddler.

post data:

{
    "BaseRequest": {
        "Uin": 12345678,
        "Sid": "xxxxxxxxxxxx",
        "Skey": "@crypt_xxxxxxx_xxxxxxx",
        "DeviceID": "xxxxxxxxx"
    },
    "Msg": {
        "Type": 5,
        "Content": "<msg><appmsg appid='wxa54deb331c142f46' sdkver='0'><title>场景变换与价值突变丨伯凡·日知录</title><des>如果懂场景变换,就可以用别针换别墅。</des><type>5</type><url>https://m.igetget.com/subscribe/ZAm8qVzDbmAR6rBe0XaZ9OG2ow24agX7hyfAd0QdEvy3Y7WLNMg5jnKxJk4l1NYb</url><appattach><attachid /><cdnthumburl>305902010004523050020100020403eb183502032f54cd0204a73da17b020459a31792042e6175706170706d73675f326337663036303730656238626534315f313530333836303632333534315f38313336370201000201000400</cdnthumburl><cdnthumbmd5>705aee971307a1ed2d6982c2d5095bec</cdnthumbmd5><cdnthumblength>18427</cdnthumblength><cdnthumbheight>120</cdnthumbheight><cdnthumbwidth>120</cdnthumbwidth><cdnthumbaeskey>02efeeeb6dbd49c3b1c9cb57d01a853b</cdnthumbaeskey><aeskey>02efeeeb6dbd49c3b1c9cb57d01a853b</aeskey><encryver>1</encryver><islargefilemsg>0</islargefilemsg></appattach></appmsg></msg>",
        "FromUserName": "@0036b74b3fd4449b80d482af37c7721f",
        "ToUserName": "@0036b74b3fd4449b80d482af37c7721f",
        "LocalID": "15038607038000076",
        "ClientMsgId": "15038607038000076"
    },
    "Scene": 2
}

return data:

{
    "BaseResponse": {
        "Ret": 1,
        "ErrMsg": ""
    },
    "MsgID": "",
    "LocalID": ""
}

After the combination of different fields, post data to test, the results are failed.
The results of my test on sending a url type message are as follows:

  1. The server directly shields the send url type of the message, when the type = 5 //URL TYPE, the direct return failed
  2. The server side is allowed to send a message of type url, but we do not know what data structure it needs

So, I think we can not achieve this function at the moment.

extra discovery

Summary some additional discoveries:

  1. Send appmsg, the server will xml data structure filter check, some of the field restrictions are very strict, such as url field.
  2. When sending appmsg, the type field in xml determines how to parse the data, and the Type field in json data may not participate in the actual judgment.
  3. When you append applets of type ATTACH, you can customize the thumbnail icons by adding the following fields
    <appattach>
      <cdnthumburl>305902010004523050020100020403eb183502032f54cd0204a73da17b020459a31792042e6175706170706d73675f326337663036303730656238626534315f313530333836303632333534315f38313336370201000201000400</cdnthumburl>
      <cdnthumbmd5>705aee971307a1ed2d6982c2d5095bec</cdnthumbmd5> // can be remove
      <cdnthumblength>18427</cdnthumblength>
      <cdnthumbheight>120</cdnthumbheight>
      <cdnthumbwidth>120</cdnthumbwidth>
      <cdnthumbaeskey>02efeeeb6dbd49c3b1c9cb57d01a853b</cdnthumbaeskey>
  </appattach>
  1. When sending appmsg, you can customize the source of the displayed message by specifying the appid attribute of the appmsg field.
<appmsg appid='wxa54deb331c142f46' sdkver='0'> // display '得到'
// ..........
</appmsg>

If you are interested in these additional discoveries, I can create a separate issue, let's implement it

@huan
Copy link
Member

huan commented Aug 28, 2017

@binsee Thanks for the details analysis about this! The result is clear and very useful, that's awesome.

So since we could not implement supporting for send url rich media message, could you close this issue for now?

@binsee binsee closed this as completed Aug 28, 2017
@binsee
Copy link
Author

binsee commented Aug 28, 2017

@ashu-22 No, the problem is not solved.

Sent from my HONOR KNT-AL20 using FastHub

@huan huan added the wontfix label Aug 28, 2017
@huan huan removed the wontfix label May 6, 2018
@huan
Copy link
Member

huan commented May 6, 2018

Reopen this issue because:

  1. We are working on new puppets... see Create New Puppets for Wechaty #1167
  2. This issue has $20 bounty... 💰

@huan huan reopened this May 6, 2018
@huan
Copy link
Member

huan commented Aug 18, 2018

Implemented by #1539

@huan huan closed this as completed Aug 18, 2018
@huan
Copy link
Member

huan commented Aug 18, 2018

@windmemory I believe you should get that $20 bounty 💰

@windmemory
Copy link
Member

Lol, can I use that bounty to 'buy' a membership in wechaty?

@huan
Copy link
Member

huan commented Aug 19, 2018

Sorry, you can not 'buy' a membership in wechaty because Wechaty membership is not for sale!

But you will be very welcome to join the wechaty contributor team after your next PR for Wechaty be merged! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants