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] sending formatted links / href tags #331

Closed
dcsan opened this Issue Mar 16, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@dcsan
Copy link

dcsan commented Mar 16, 2017

Is it possible to send formatted links from WeChaty?

from the web client if you send a link you will be able to view it yourself
image

it will send a nice link:
image

However on a native client it gets broken:
image

I'm assuming that on other clients (eg connected web clients from other users) it is broken too.

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

so it seems like wechat does something server side to filter and prevent sending of links.

From official accounts you can send HREF tags no problem, and they arrive nicely formatted.

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

using a native client, from the embedded browser you can "Send to chat" and it will provide a nicely formatted card.

image

However from the web client you don't have this feature, or even a way to forward this card.
So there doesn't seem to be a nice way to link between groupsbot and official accounts, other than bare URLs.

@dcsan dcsan changed the title [Feature] sending links [Feature] sending formatted links / href tags Mar 16, 2017

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

from an official account there were some problems with sending HREFs, eg you have to use single quotes for the URL part.

@lijiarui

This comment has been minimized.

Copy link
Member

lijiarui commented Mar 16, 2017

It seems web puppet cannot do this kind of thing, but I found other product can do, as the pic shows:
11489639842_

Maybe wechaty can access other puppet such as Android puppet or other frame to do this.
I think it's really useful for this feature.

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

When messages are sent from wechaty any URL links are just stripped out to plain text.

# send
this is <a href="http://bing.com">a link</a>

# recv
this is a link

this is watching data that the web client (wechaty) gets back not just what is displayed.

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

when receiving a formatted card link

image

msg.type() is 49 which is defined as MsgType.APP

but no custom handling is implemented for this message type yet it seems.

@dcsan

This comment has been minimized.

Copy link
Author

dcsan commented Mar 16, 2017

this is the content delivered when a link card is forwarded
but this forwarding cannot be done from the web client. It's unclear if a message like this could be sent from the wechaty API since that is connected as a webclient.

{
  "MsgId": "906811625006xxx",
  "FromUserName": "@@xxxx",
  "ToUserName": "@xxxx",
  "MsgType": 49,
  "Content": "@xxxx:<br/>&lt;msg&gt;&lt;appmsg appid=\"\" sdkver=\"0\"&gt;&lt;title&gt;Bing&lt;/title&gt;&lt;des&gt;http://cn.bing.com/?from=groupmessage&amp;amp;isappinstalled=0&lt;/des&gt;&lt;action&gt;&lt;/action&gt;&lt;type&gt;5&lt;/type&gt;&lt;showtype&gt;0&lt;/showtype&gt;&lt;soundtype&gt;0&lt;/soundtype&gt;&lt;mediatagname&gt;&lt;/mediatagname&gt;&lt;messageext&gt;&lt;/messageext&gt;&lt;messageaction&gt;&lt;/messageaction&gt;&lt;content&gt;&lt;/content&gt;&lt;contentattr&gt;0&lt;/contentattr&gt;&lt;url&gt;http://cn.bing.com/?from=groupmessage&amp;amp;isappinstalled=0&lt;/url&gt;&lt;lowurl&gt;&lt;/lowurl&gt;&lt;dataurl&gt;&lt;/dataurl&gt;&lt;lowdataurl&gt;&lt;/lowdataurl&gt;&lt;appattach&gt;&lt;totallen&gt;0&lt;/totallen&gt;&lt;attachid&gt;&lt;/attachid&gt;&lt;emoticonmd5&gt;&lt;/emoticonmd5&gt;&lt;fileext&gt;&lt;/fileext&gt;&lt;cdnthumburl&gt;304b0201000444304202010002042a4a844802033d11fd0204b4e2e265020458ca03a10420363038353937363436334063686174726f6f6d32385f313438393633343230380201000201000400&lt;/cdnthumburl&gt;&lt;cdnthumbmd5&gt;d428cf4b15b8756702551fe3bd0adf7b&lt;/cdnthumbmd5&gt;&lt;cdnthumblength&gt;7419&lt;/cdnthumblength&gt;&lt;cdnthumbwidth&gt;160&lt;/cdnthumbwidth&gt;&lt;cdnthumbheight&gt;160&lt;/cdnthumbheight&gt;&lt;cdnthumbaeskey&gt;d2096d266e7949be8c5bc20ac6704087&lt;/cdnthumbaeskey&gt;&lt;aeskey&gt;d2096d266e7949be8c5bc20ac6704087&lt;/aeskey&gt;&lt;encryver&gt;0&lt;/encryver&gt;&lt;/appattach&gt;&lt;extinfo&gt;&lt;/extinfo&gt;&lt;sourceusername&gt;&lt;/sourceusername&gt;&lt;sourcedisplayname&gt;&lt;/sourcedisplayname&gt;&lt;thumburl&gt;http://s1.cn.bing.net/th?id=OJ.ORCLss3bypt03w&amp;amp;pid=MSNJVFeeds&lt;/thumburl&gt;&lt;md5&gt;&lt;/md5&gt;&lt;statextstr&gt;&lt;/statextstr&gt;&lt;/appmsg&gt;&lt;fromusername&gt;wxid_6b78gjeal0bt22&lt;/fromusername&gt;&lt;scene&gt;0&lt;/scene&gt;&lt;appinfo&gt;&lt;version&gt;1&lt;/version&gt;&lt;appname&gt;&lt;/appname&gt;&lt;/appinfo&gt;&lt;commenturl&gt;&lt;/commenturl&gt;&lt;/msg&gt;<br/>",
  "Status": 3,
  "ImgStatus": 2,
  "CreateTime": xxxx,
  "VoiceLength": 0,
  "PlayLength": 0,
  "FileName": "Bing",
  "FileSize": "0",
  "MediaId": "",
  "Url": "http://cn.bing.com/?from=groupmessage&amp;isappinstalled=0",
  "AppMsgType": 5,
  "StatusNotifyCode": 0,
  "StatusNotifyUserName": "",
  "RecommendInfo": {
    "UserName": "",
    "NickName": "",
    "QQNum": 0,
    "Province": "",
    "City": "",
    "Content": "",
    "Signature": "",
    "Alias": "",
    "Scene": 0,
    "VerifyFlag": 0,
    "AttrStatus": 0,
    "Sex": 0,
    "Ticket": "",
    "OpCode": 0
  },
  "ForwardFlag": 0,
  "AppInfo": {
    "AppID": "",
    "Type": 0
  },
  "HasProductId": 0,
  "Ticket": "",
  "ImgHeight": 0,
  "ImgWidth": 0,
  "SubMsgType": 0,
  "NewMsgId": xxxx,
  "OriContent": "",
  "MMPeerUserName": "@@xxxx",
  "MMDigest": "mr magic:[link]Bing",
  "MMIsSend": false,
  "MMIsChatRoom": true,
  "MMUnread": true,
  "LocalID": "xxxx",
  "ClientMsgId": "xxx",
  "MMActualContent": "&lt;msg&gt;&lt;appmsg appid=\"\" sdkver=\"0\"&gt;&lt;title&gt;Bing&lt;/title&gt;&lt;des&gt;http://cn.bing.com/?from=groupmessage&amp;amp;isappinstalled=0&lt;/des&gt;&lt;action&gt;&lt;/action&gt;&lt;type&gt;5&lt;/type&gt;&lt;showtype&gt;0&lt;/showtype&gt;&lt;soundtype&gt;0&lt;/soundtype&gt;&lt;mediatagname&gt;&lt;/mediatagname&gt;&lt;messageext&gt;&lt;/messageext&gt;&lt;messageaction&gt;&lt;/messageaction&gt;&lt;content&gt;&lt;/content&gt;&lt;contentattr&gt;0&lt;/contentattr&gt;&lt;url&gt;http://cn.bing.com/?from=groupmessage&amp;amp;isappinstalled=0&lt;/url&gt;&lt;lowurl&gt;&lt;/lowurl&gt;&lt;dataurl&gt;&lt;/dataurl&gt;&lt;lowdataurl&gt;&lt;/lowdataurl&gt;&lt;appattach&gt;&lt;totallen&gt;0&lt;/totallen&gt;&lt;attachid&gt;&lt;/attachid&gt;&lt;emoticonmd5&gt;&lt;/emoticonmd5&gt;&lt;fileext&gt;&lt;/fileext&gt;&lt;cdnthumburl&gt;304b0201000444304202010002042a4a844802033d11fd0204b4e2e265020458ca03a10420363038353937363436334063686174726f6f6d32385f313438393633343230380201000201000400&lt;/cdnthumburl&gt;&lt;cdnthumbmd5&gt;d428cf4b15b8756702551fe3bd0adf7b&lt;/cdnthumbmd5&gt;&lt;cdnthumblength&gt;7419&lt;/cdnthumblength&gt;&lt;cdnthumbwidth&gt;160&lt;/cdnthumbwidth&gt;&lt;cdnthumbheight&gt;160&lt;/cdnthumbheight&gt;&lt;cdnthumbaeskey&gt;d2096d266e7949be8c5bc20ac6704087&lt;/cdnthumbaeskey&gt;&lt;aeskey&gt;d2096d266e7949be8c5bc20ac6704087&lt;/aeskey&gt;&lt;encryver&gt;0&lt;/encryver&gt;&lt;/appattach&gt;&lt;extinfo&gt;&lt;/extinfo&gt;&lt;sourceusername&gt;&lt;/sourceusername&gt;&lt;sourcedisplayname&gt;&lt;/sourcedisplayname&gt;&lt;thumburl&gt;http://s1.cn.bing.net/th?id=OJ.ORCLss3bypt03w&amp;amp;pid=MSNJVFeeds&lt;/thumburl&gt;&lt;md5&gt;&lt;/md5&gt;&lt;statextstr&gt;&lt;/statextstr&gt;&lt;/appmsg&gt;&lt;fromusername&gt;wxid_6b78gjeal0bt22&lt;/fromusername&gt;&lt;scene&gt;0&lt;/scene&gt;&lt;appinfo&gt;&lt;version&gt;1&lt;/version&gt;&lt;appname&gt;&lt;/appname&gt;&lt;/appinfo&gt;&lt;commenturl&gt;&lt;/commenturl&gt;&lt;/msg&gt;<br/>",
  "MMActualSender": "@xxxx",
  "MMDigestTime": "13:06",
  "MMDisplayTime": xxxx,
  "MMTime": "13:06",
  "MMIsAppMsg": true,
  "MMAppMsgDesc": "http://cn.bing.com/?from=groupmessage&isappinstalled=0"
}

@huan

This comment has been minimized.

Copy link
Member

huan commented Aug 18, 2017

Duplicated with #718

@huan huan closed this Aug 18, 2017

@huan huan added the duplicate label Aug 18, 2017

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